/** * The error message number * * @access private * @return integer */ function _error_number() { return cubrid_errno($this->conn_id); }
/** * Retrieve error messages from the database * * @return string */ protected function get_db_error_message() { if (substr(CI_VERSION, 0, 1) != '2') { $error = $this->db->error(); return isset($error['message']) ? $error['message'] : ''; } switch ($this->db->platform()) { case 'cubrid': return cubrid_errno($this->db->conn_id); case 'mssql': return mssql_get_last_message(); case 'mysql': return mysql_error($this->db->conn_id); case 'mysqli': return mysqli_error($this->db->conn_id); case 'oci8': // If the error was during connection, no conn_id should be passed $error = is_resource($this->db->conn_id) ? oci_error($this->db->conn_id) : oci_error(); return $error['message']; case 'odbc': return odbc_errormsg($this->db->conn_id); case 'pdo': $error_array = $this->db->conn_id->errorInfo(); return $error_array[2]; case 'postgre': return pg_last_error($this->db->conn_id); case 'sqlite': return sqlite_error_string(sqlite_last_error($this->db->conn_id)); case 'sqlsrv': $error = array_shift(sqlsrv_errors()); return !empty($error['message']) ? $error['message'] : null; default: // !WARNING! $this->db->_error_message() is supposed to be private // and possibly won't be available in future versions of CI. return $this->db->_error_message(); } }
/** * Error * * Returns an array containing code and message of the last * database error that has occured. * * @return array */ public function error() { return array('code' => cubrid_errno($this->conn_id), 'message' => cubrid_error($this->conn_id)); }
/** * Allows you to retrieve error messages from the database * * @return string */ public function get_db_error_message($db_type) { switch ($this->{$db_type}->platform()) { case 'cubrid': return cubrid_errno($this->{$db_type}->conn_id); case 'mssql': return mssql_get_last_message(); case 'mysql': return mysql_error($this->{$db_type}->conn_id); case 'mysqli': return mysqli_error($this->{$db_type}->conn_id); case 'oci8': // If the error was during connection, no conn_id should be passed $error = is_resource($this->{$db_type}->conn_id) ? oci_error($this->{$db_type}->conn_id) : oci_error(); return $error['message']; case 'odbc': return odbc_errormsg($this->{$db_type}->conn_id); case 'pdo': $error_array = $this->{$db_type}->conn_id->errorInfo(); return $error_array[2]; case 'postgre': return pg_last_error($this->{$db_type}->conn_id); case 'sqlite': return sqlite_error_string(sqlite_last_error($this->{$db_type}->conn_id)); case 'sqlsrv': $error = array_shift(sqlsrv_errors()); return !empty($error['message']) ? $error['message'] : null; default: /* * !WARNING! $this->{$db_type}->_error_message() is supposed to be private and * possibly won't be available in future versions of CI */ return $this->{$db_type}->_error_message(); } }