*/
protected abstract function _affectedRows($result);
+ // ###################################################################
+ /**
+ * Returns the errror number
+ */
+ public abstract function _errorNumber();
+
+ /**
+ * Returns the error string
+ */
+ public abstract function _errorString();
+
// ###################################################################
/**
* Sends the command to start a transaction. This command should never
{
if ($this->showerrors)
{
- if ($this->dblink)
- {
- $this->errnum = call_user_func($this->commands['error_num'], $this->dblink);
- $this->errstr = call_user_func($this->commands['error_str'], $this->dblink);
- }
-
$style['code'] = 'font-family: \'Courier New\', Courier, mono; font-size: 11px;';
$message_prepped = "<blockquote>\n<p>";
$message_prepped .= "\n\t» <strong>Query:</strong>\n<br /> <pre style=\"$style[code]\">" . htmlspecialchars($this->querystr) ."</pre>\n<br />";
- $message_prepped .= "\n\t» <strong>Error Number:</strong> <span style=\"$style[code]\">" . $this->errnum . "</span>\n<br />";
- $message_prepped .= "\n\t» <strong>Error Message:</strong> <span style=\"$style[code]\">" . $this->errstr . "</span>\n<br />";
+ $message_prepped .= "\n\t» <strong>Error Number:</strong> <span style=\"$style[code]\">" . $this->_errorNumber() . "</span>\n<br />";
+ $message_prepped .= "\n\t» <strong>Error Message:</strong> <span style=\"$style[code]\">" . $this->_errorString() . "</span>\n<br />";
$message_prepped .= "\n\t» <strong>Additional Notes:</strong> <span style=\"$style[code]\">" . $message . "</span>\n<br />";
$message_prepped .= "\n\t» <strong>File:</strong> <span style=\"$style[code]\">" . $_SERVER['PHP_SELF'] . "</span>\n";
$message_prepped .= "\n</p>\n</blockquote>";
{
$this->query("COMMIT");
}
+
+ // ###################################################################
+ /**
+ * Returns the error number
+ *
+ * @return integer Error number
+ */
+ public function _errorNumber()
+ {
+ return mysql_errno($this->dblink);
+ }
+
+ // ###################################################################
+ /**
+ * Returns the error string
+ *
+ * @return string Error string
+ */
+ public function _errorString()
+ {
+ return mysql_error($this->dblink);
+ }
}
/*=====================================================================*\
{
$this->query("COMMIT");
}
+
+ // ###################################################################
+ /**
+ * Returns the error number
+ *
+ * @return integer Error number
+ */
+ public function _errorNumber()
+ {
+ return mysqli_errno($this->dblink);
+ }
+
+ // ###################################################################
+ /**
+ * Returns the error string
+ *
+ * @return string Error string
+ */
+ public function _errorString()
+ {
+ return mysqli_error($this->dblink);
+ }
}
/*=====================================================================*\
*/
class BSDbPostgreSql extends BSDb
{
- /**
- * Command mapping list
- * @var array
- */
- protected $commands = array(
- 'pconnect' => '$this->command_pg_pconnect',
- 'connect' => '$this->command_pg_connect',
- 'query' => 'pg_query',
- 'error_num' => '$this->command_error_num',
- 'error_str' => '$this->command_error_str',
- 'escape_string' => '$this->command_pg_escape_string',
- 'escape_binary' => 'pg_escape_bytea',
- 'unescape_binary' => 'pg_unescape_bytea',
- 'fetch_assoc' => 'pg_fetch_assoc',
- 'fetch_row' => 'pg_fetch_row',
- 'fetch_object' => 'pg_fetch_object',
- 'free_result' => 'pg_free_result',
- 'insert_id' => '%link', // how do we support this...?
- 'num_rows' => 'pg_num_rows',
- 'affected_rows' => 'pg_affected_rows'
- );
-
/**
* Port number to connect to
* @var integer
{
$this->query("COMMIT");
}
+
+ // ###################################################################
+ /**
+ * Returns the error number
+ *
+ * @return integer Error number
+ */
+ public function _errorNumber()
+ {
+ return -1;
+ }
+
+ // ###################################################################
+ /**
+ * Returns the error string
+ *
+ * @return string Error string
+ */
+ public function _errorString()
+ {
+ return pg_last_error($this->dblink);
+ }
}
/*=====================================================================*\