Reset error before using in SQL query
This commit is contained in:
parent
6a3cf71db5
commit
7291ae608d
|
@ -43,6 +43,7 @@ if (isset($_GET["mssql"])) {
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = sqlsrv_query($this->_link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
|
$result = sqlsrv_query($this->_link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->_get_error();
|
$this->_get_error();
|
||||||
return false;
|
return false;
|
||||||
|
@ -52,6 +53,7 @@ if (isset($_GET["mssql"])) {
|
||||||
|
|
||||||
function multi_query($query) {
|
function multi_query($query) {
|
||||||
$this->_result = sqlsrv_query($this->_link, $query);
|
$this->_result = sqlsrv_query($this->_link, $query);
|
||||||
|
$this->error = "";
|
||||||
if (!$this->_result) {
|
if (!$this->_result) {
|
||||||
$this->_get_error();
|
$this->_get_error();
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,6 +161,7 @@ if (isset($_GET["mssql"])) {
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = mssql_query($query, $this->_link); //! $unbuffered
|
$result = mssql_query($query, $this->_link); //! $unbuffered
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = mssql_get_last_message();
|
$this->error = mssql_get_last_message();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -108,6 +108,7 @@ if (!defined("DRIVER")) {
|
||||||
*/
|
*/
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
|
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = mysql_error($this->_link);
|
$this->error = mysql_error($this->_link);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,6 +37,7 @@ if (isset($_GET["oracle"])) {
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = oci_parse($this->_link, $query);
|
$result = oci_parse($this->_link, $query);
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$error = oci_error($this->_link);
|
$error = oci_error($this->_link);
|
||||||
$this->error = $error["message"];
|
$this->error = $error["message"];
|
||||||
|
|
|
@ -58,6 +58,7 @@ if (isset($_GET["pgsql"])) {
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = @pg_query($this->_link, $query);
|
$result = @pg_query($this->_link, $query);
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = pg_last_error($this->_link);
|
$this->error = pg_last_error($this->_link);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,6 +19,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
|
|
||||||
function query($query) {
|
function query($query) {
|
||||||
$result = @$this->_link->query($query);
|
$result = @$this->_link->query($query);
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = $this->_link->lastErrorMsg();
|
$this->error = $this->_link->lastErrorMsg();
|
||||||
return false;
|
return false;
|
||||||
|
@ -93,6 +94,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$method = ($unbuffered ? "unbufferedQuery" : "query");
|
$method = ($unbuffered ? "unbufferedQuery" : "query");
|
||||||
$result = @$this->_link->$method($query, SQLITE_BOTH, $error);
|
$result = @$this->_link->$method($query, SQLITE_BOTH, $error);
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = $error;
|
$this->error = $error;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,6 +24,7 @@ if (extension_loaded('pdo')) {
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = parent::query($query);
|
$result = parent::query($query);
|
||||||
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$errorInfo = $this->errorInfo();
|
$errorInfo = $this->errorInfo();
|
||||||
$this->error = $errorInfo[2];
|
$this->error = $errorInfo[2];
|
||||||
|
|
Loading…
Reference in a new issue