diff options
| author | Damien Regad <dregad@mantisbt.org> | 2018-03-30 19:29:59 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2018-03-30 19:29:59 +0200 |
| commit | 4011379abe34845d44612dbe904f435b6cd81d9f (patch) | |
| tree | e4c2e8a086ce635ad267c202fcb9a38b01dc2649 /drivers | |
| parent | 0f82a576c73172fcab8e9f03a5dedfc6fb9a01ec (diff) | |
| parent | 1377bc3f9ae50d935da2ff83784a6ff5640cba68 (diff) | |
| download | adodb-4011379abe34845d44612dbe904f435b6cd81d9f.tar.gz adodb-4011379abe34845d44612dbe904f435b6cd81d9f.tar.bz2 adodb-4011379abe34845d44612dbe904f435b6cd81d9f.zip | |
Merge branch 'hotfix/5.20'
Conflicts:
adodb.inc.php
docs/changelog.md
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-ads.inc.php | 29 | ||||
| -rw-r--r-- | drivers/adodb-db2.inc.php | 13 | ||||
| -rw-r--r-- | drivers/adodb-odbc.inc.php | 25 | ||||
| -rw-r--r-- | drivers/adodb-odbc_oracle.inc.php | 10 | ||||
| -rw-r--r-- | drivers/adodb-odbtp.inc.php | 5 | ||||
| -rw-r--r-- | drivers/adodb-sybase.inc.php | 3 |
6 files changed, 35 insertions, 50 deletions
diff --git a/drivers/adodb-ads.inc.php b/drivers/adodb-ads.inc.php index c678c9de..8d31b219 100644 --- a/drivers/adodb-ads.inc.php +++ b/drivers/adodb-ads.inc.php @@ -80,11 +80,10 @@ class ADODB_ads extends ADOConnection { if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') { ADOConnection::outp("For Advantage Connect(), $argDatabasename is not used. Place dsn in 1st parameter."); } - error_clear_last(); + $last_php_error = $this->resetLastError(); if ($this->curmode === false) $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword,$this->curmode); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); return $this->_connectionID != false; @@ -93,10 +92,10 @@ class ADODB_ads extends ADOConnection { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - if (!function_exists('ads_connect')) return null; - error_clear_last(); + $last_php_error = $this->resetLastError(); + $this->_errorMsg = ''; if ($this->debug && $argDatabasename) { ADOConnection::outp("For PConnect(), $argDatabasename is not used. Place dsn in 1st parameter."); } @@ -104,8 +103,7 @@ class ADODB_ads extends ADOConnection { if ($this->curmode === false) $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = ads_pconnect($argDSN,$argUsername,$argPassword,$this->curmode); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); if ($this->_connectionID && $this->autoRollback) @ads_rollback($this->_connectionID); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); @@ -517,8 +515,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od /* returns queryID or false */ function _query($sql,$inputarr=false) { - error_clear_last(); - $this->_error = ''; + $last_php_error = $this->resetLastError(); + $this->_errorMsg = ''; if ($inputarr) { if (is_array($sql)) { @@ -527,8 +525,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $stmtid = ads_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); return false; } } @@ -579,16 +576,14 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $this->_errorMsg = ''; $this->_errorCode = 0; } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } else { if ($this->_haserrorfunctions) { $this->_errorMsg = ads_errormsg(); $this->_errorCode = ads_error(); } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } @@ -607,11 +602,11 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od */ function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB') { + $last_php_error = $this->resetLastError(); $sql = "UPDATE $table SET $column=? WHERE $where"; $stmtid = ads_prepare($this->_connectionID,$sql); if ($stmtid == false){ - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); return false; } if (! ads_execute($stmtid,array($val),array(SQL_BINARY) )){ diff --git a/drivers/adodb-db2.inc.php b/drivers/adodb-db2.inc.php index d5b92665..a56385d2 100644 --- a/drivers/adodb-db2.inc.php +++ b/drivers/adodb-db2.inc.php @@ -108,6 +108,8 @@ class ADODB_db2 extends ADOConnection { // Replaces the odbc_binmode() call that was in Execute() ini_set('ibm_db2.binmode', $this->binmode); + $this->_errorMsg = ''; + if ($argDatabasename && empty($argDSN)) { if (stripos($argDatabasename,'UID=') && stripos($argDatabasename,'PWD=')) $this->_connectionID = db2_pconnect($argDatabasename,null,null); @@ -619,7 +621,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 /* returns queryID or false */ function _query($sql,$inputarr=false) { - error_clear_last(); + $last_php_error = $this->resetLastError(); $this->_errorMsg = ''; if ($inputarr) { @@ -629,8 +631,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 $stmtid = db2_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); return false; } } @@ -668,16 +669,14 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 $this->_errorMsg = ''; $this->_errorCode = 0; } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } else { if ($this->_haserrorfunctions) { $this->_errorMsg = db2_stmt_errormsg(); $this->_errorCode = db2_stmt_error(); } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } return $stmtid; diff --git a/drivers/adodb-odbc.inc.php b/drivers/adodb-odbc.inc.php index 52b26307..8101dae5 100644 --- a/drivers/adodb-odbc.inc.php +++ b/drivers/adodb-odbc.inc.php @@ -76,11 +76,10 @@ class ADODB_odbc extends ADOConnection { $argDSN .= 'Database='.$argDatabasename; } - error_clear_last(); + $last_php_error = $this->resetLastError(); if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); return $this->_connectionID != false; @@ -89,10 +88,10 @@ class ADODB_odbc extends ADOConnection { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - if (!function_exists('odbc_connect')) return null; - error_clear_last(); + $last_php_error = $this->resetLastError(); + $this->_errorMsg = ''; if ($this->debug && $argDatabasename) { ADOConnection::outp("For odbc PConnect(), $argDatabasename is not used. Place dsn in 1st parameter."); } @@ -100,8 +99,7 @@ class ADODB_odbc extends ADOConnection { if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); @@ -527,8 +525,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od /* returns queryID or false */ function _query($sql,$inputarr=false) { - error_clear_last(); - $this->_error = ''; + $last_php_error = $this->resetLastError(); + $this->_errorMsg = ''; if ($inputarr) { if (is_array($sql)) { @@ -537,8 +535,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $stmtid = odbc_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); return false; } } @@ -580,16 +577,14 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $this->_errorMsg = ''; $this->_errorCode = 0; } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } else { if ($this->_haserrorfunctions) { $this->_errorMsg = odbc_errormsg(); $this->_errorCode = odbc_error(); } else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); } } return $stmtid; diff --git a/drivers/adodb-odbc_oracle.inc.php b/drivers/adodb-odbc_oracle.inc.php index eb83c1ee..874c4ddd 100644 --- a/drivers/adodb-odbc_oracle.inc.php +++ b/drivers/adodb-odbc_oracle.inc.php @@ -76,10 +76,9 @@ class ADODB_odbc_oracle extends ADODB_odbc { // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { - error_clear_last(); + $last_php_error = $this->resetLastError(); $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); @@ -88,10 +87,9 @@ class ADODB_odbc_oracle extends ADODB_odbc { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - error_clear_last(); + $last_php_error = $this->resetLastError(); $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); diff --git a/drivers/adodb-odbtp.inc.php b/drivers/adodb-odbtp.inc.php index 6beec767..4214d0f6 100644 --- a/drivers/adodb-odbtp.inc.php +++ b/drivers/adodb-odbtp.inc.php @@ -605,7 +605,7 @@ class ADODB_odbtp extends ADOConnection{ function _query($sql,$inputarr=false) { - error_clear_last(); + $last_php_error = $this->resetLastError(); $this->_errorMsg = false; $this->_errorCode = false; @@ -615,8 +615,7 @@ class ADODB_odbtp extends ADOConnection{ } else { $stmtid = @odbtp_prepare($sql,$this->_connectionID); if ($stmtid == false) { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : ''; + $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); return false; } } diff --git a/drivers/adodb-sybase.inc.php b/drivers/adodb-sybase.inc.php index 8604e24c..e53af531 100644 --- a/drivers/adodb-sybase.inc.php +++ b/drivers/adodb-sybase.inc.php @@ -114,8 +114,7 @@ class ADODB_sybase extends ADOConnection { if (function_exists('sybase_get_last_message')) $this->_errorMsg = sybase_get_last_message(); else { - $err = error_get_last(); - $this->_errorMsg = $err ? $err['message'] : 'SYBASE error messages not supported on this platform'; + $this->_errorMsg = 'SYBASE error messages not supported on this platform'; } return $this->_errorMsg; |
