/** * Alias of the get_last_errno() function * * @see AutoCRUD_Error::get_last_errno() */ function get_last_errcode($which = 1) { return AutoCRUD_Error::get_last_errno($which); }
/** * Used to check if a unique error happened * * @access public * @param string $keyname the name of a specific index * @return bool whether a unique error has happened or not */ function unique_error($keyname = null) { $errno = AutoCRUD_Error::get_last_errno(2); $errmsg = AutoCRUD_Error::get_last_errmsg(2); // No unique error? if ($errno != 1062) { return false; } // No keyname? if (!isset($keyname)) { return true; } // Parse key $split = explode(' ', $errmsg); $key = $split[count($split) - 1]; // Check if it's a valid index if (!isset($this->indexes[$key])) { $this->halt('invalid-index', 'Invalid index during unique error'); return false; } // Check if they match if ($this->indexes[$key] != $keyname) { return false; } return true; }