Permalink
Browse files

Reset error before using in SQL query

  • Loading branch information...
1 parent 6a3cf71 commit 7291ae608dd3f61c6c22423aa8a86715b6afa2f9 @vrana committed Jul 15, 2012
@@ -43,6 +43,7 @@ function select_db($database) {
function query($query, $unbuffered = false) {
$result = sqlsrv_query($this->_link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
+ $this->error = "";
if (!$result) {
$this->_get_error();
return false;
@@ -52,6 +53,7 @@ function query($query, $unbuffered = false) {
function multi_query($query) {
$this->_result = sqlsrv_query($this->_link, $query);
+ $this->error = "";
if (!$this->_result) {
$this->_get_error();
return false;
@@ -159,6 +161,7 @@ function select_db($database) {
function query($query, $unbuffered = false) {
$result = mssql_query($query, $this->_link); //! $unbuffered
+ $this->error = "";
if (!$result) {
$this->error = mssql_get_last_message();
return false;
@@ -108,6 +108,7 @@ function select_db($database) {
*/
function query($query, $unbuffered = false) {
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
+ $this->error = "";
if (!$result) {
$this->error = mysql_error($this->_link);
return false;
@@ -37,6 +37,7 @@ function select_db($database) {
function query($query, $unbuffered = false) {
$result = oci_parse($this->_link, $query);
+ $this->error = "";
if (!$result) {
$error = oci_error($this->_link);
$this->error = $error["message"];
@@ -58,6 +58,7 @@ function close() {
function query($query, $unbuffered = false) {
$result = @pg_query($this->_link, $query);
+ $this->error = "";
if (!$result) {
$this->error = pg_last_error($this->_link);
return false;
@@ -19,6 +19,7 @@ function Min_SQLite($filename) {
function query($query) {
$result = @$this->_link->query($query);
+ $this->error = "";
if (!$result) {
$this->error = $this->_link->lastErrorMsg();
return false;
@@ -93,6 +94,7 @@ function Min_SQLite($filename) {
function query($query, $unbuffered = false) {
$method = ($unbuffered ? "unbufferedQuery" : "query");
$result = @$this->_link->$method($query, SQLITE_BOTH, $error);
+ $this->error = "";
if (!$result) {
$this->error = $error;
return false;
@@ -24,6 +24,7 @@ function dsn($dsn, $username, $password, $exception_handler = 'auth_error') {
function query($query, $unbuffered = false) {
$result = parent::query($query);
+ $this->error = "";
if (!$result) {
$errorInfo = $this->errorInfo();
$this->error = $errorInfo[2];

0 comments on commit 7291ae6

Please sign in to comment.