diff options
| -rw-r--r-- | drivers/adodb-ads.inc.php | 45 | ||||
| -rw-r--r-- | drivers/adodb-borland_ibase.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-csv.inc.php | 4 | ||||
| -rw-r--r-- | drivers/adodb-db2.inc.php | 33 | ||||
| -rw-r--r-- | drivers/adodb-mssql.inc.php | 9 | ||||
| -rw-r--r-- | drivers/adodb-mssqlnative.inc.php | 7 | ||||
| -rw-r--r-- | drivers/adodb-mysql.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-oci8.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-odbc.inc.php | 32 | ||||
| -rw-r--r-- | drivers/adodb-odbc_mssql.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-odbc_oracle.inc.php | 13 | ||||
| -rw-r--r-- | drivers/adodb-odbtp.inc.php | 8 | ||||
| -rw-r--r-- | drivers/adodb-pdo_pgsql.inc.php | 14 | ||||
| -rw-r--r-- | drivers/adodb-pdo_sqlite.inc.php | 10 | ||||
| -rw-r--r-- | drivers/adodb-postgres7.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-sqlite.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-sqlite3.inc.php | 2 | ||||
| -rw-r--r-- | drivers/adodb-sybase.inc.php | 7 | ||||
| -rw-r--r-- | drivers/adodb-text.inc.php | 3 |
20 files changed, 115 insertions, 86 deletions
diff --git a/drivers/adodb-ads.inc.php b/drivers/adodb-ads.inc.php index d59df663..c678c9de 100644 --- a/drivers/adodb-ads.inc.php +++ b/drivers/adodb-ads.inc.php @@ -75,17 +75,16 @@ class ADODB_ads extends ADOConnection { // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - if (!function_exists('ads_connect')) return null; if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') { ADOConnection::outp("For Advantage Connect(), $argDatabasename is not used. Place dsn in 1st parameter."); } - if (isset($php_errormsg)) $php_errormsg = ''; + error_clear_last(); if ($this->curmode === false) $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword,$this->curmode); - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; if (isset($this->connectStmt)) $this->Execute($this->connectStmt); return $this->_connectionID != false; @@ -94,12 +93,10 @@ class ADODB_ads extends ADOConnection { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; if (!function_exists('ads_connect')) return null; - if (isset($php_errormsg)) $php_errormsg = ''; - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + error_clear_last(); if ($this->debug && $argDatabasename) { ADOConnection::outp("For PConnect(), $argDatabasename is not used. Place dsn in 1st parameter."); } @@ -107,7 +104,8 @@ 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); - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; if ($this->_connectionID && $this->autoRollback) @ads_rollback($this->_connectionID); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); @@ -519,8 +517,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od /* returns queryID or false */ function _query($sql,$inputarr=false) { - GLOBAL $php_errormsg; - if (isset($php_errormsg)) $php_errormsg = ''; + error_clear_last(); $this->_error = ''; if ($inputarr) { @@ -530,7 +527,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $stmtid = ads_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; return false; } } @@ -563,8 +561,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $this->_lastAffectedRows = 0; - if ($stmtid) - { + if ($stmtid) { if (@ads_num_fields($stmtid) == 0) { $this->_lastAffectedRows = ads_num_rows($stmtid); @@ -578,22 +575,21 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od } - if ($this->_haserrorfunctions) - { - + if ($this->_haserrorfunctions) { $this->_errorMsg = ''; $this->_errorCode = 0; + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; } - else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - } - else - { + } else { if ($this->_haserrorfunctions) { $this->_errorMsg = ads_errormsg(); $this->_errorCode = ads_error(); - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; + } } return $stmtid; @@ -614,7 +610,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $sql = "UPDATE $table SET $column=? WHERE $where"; $stmtid = ads_prepare($this->_connectionID,$sql); if ($stmtid == false){ - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; return false; } if (! ads_execute($stmtid,array($val),array(SQL_BINARY) )){ diff --git a/drivers/adodb-borland_ibase.inc.php b/drivers/adodb-borland_ibase.inc.php index 7c08f354..20af24d3 100644 --- a/drivers/adodb-borland_ibase.inc.php +++ b/drivers/adodb-borland_ibase.inc.php @@ -53,6 +53,8 @@ class ADODB_borland_ibase extends ADODB_ibase { // SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; if ($nrows > 0) { if ($offset <= 0) $str = " ROWS $nrows "; else { diff --git a/drivers/adodb-csv.inc.php b/drivers/adodb-csv.inc.php index bceaf394..69de8cbc 100644 --- a/drivers/adodb-csv.inc.php +++ b/drivers/adodb-csv.inc.php @@ -79,8 +79,10 @@ class ADODB_csv extends ADOConnection { // parameters use PostgreSQL convention, not MySQL function SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0) { - global $ADODB_FETCH_MODE; + global $ADODB_FETCH_MODE; + $nrows = (int) $nrows; + $offset = (int) $offset; $url = $this->_url.'?sql='.urlencode($sql)."&nrows=$nrows&fetch=". (($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE). "&offset=$offset"; diff --git a/drivers/adodb-db2.inc.php b/drivers/adodb-db2.inc.php index be84ae49..d5b92665 100644 --- a/drivers/adodb-db2.inc.php +++ b/drivers/adodb-db2.inc.php @@ -71,8 +71,6 @@ class ADODB_db2 extends ADOConnection { // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - if (!function_exists('db2_connect')) { ADOConnection::outp("Warning: The old ODBC based DB2 driver has been renamed 'odbc_db2'. This ADOdb driver calls PHP's native db2 extension which is not installed."); return null; @@ -90,7 +88,6 @@ class ADODB_db2 extends ADOConnection { if (stripos($argDSN,'UID=') && stripos($argDSN,'PWD=')) $this->_connectionID = db2_connect($argDSN,null,null); else $this->_connectionID = db2_connect($argDSN,$argUsername,$argPassword); } - if (isset($php_errormsg)) $php_errormsg = ''; // For db2_connect(), there is an optional 4th arg. If present, it must be // an array of valid options. So far, we don't use them. @@ -105,17 +102,12 @@ class ADODB_db2 extends ADOConnection { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - if (!function_exists('db2_connect')) return null; // This needs to be set before the connect(). // Replaces the odbc_binmode() call that was in Execute() ini_set('ibm_db2.binmode', $this->binmode); - if (isset($php_errormsg)) $php_errormsg = ''; - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - if ($argDatabasename && empty($argDSN)) { if (stripos($argDatabasename,'UID=') && stripos($argDatabasename,'PWD=')) $this->_connectionID = db2_pconnect($argDatabasename,null,null); @@ -125,7 +117,6 @@ class ADODB_db2 extends ADOConnection { if (stripos($argDSN,'UID=') && stripos($argDSN,'PWD=')) $this->_connectionID = db2_pconnect($argDSN,null,null); else $this->_connectionID = db2_pconnect($argDSN,$argUsername,$argPassword); } - if (isset($php_errormsg)) $php_errormsg = ''; $this->_errorMsg = @db2_conn_errormsg(); if ($this->_connectionID && $this->autoRollback) @db2_rollback($this->_connectionID); @@ -243,7 +234,8 @@ class ADODB_db2 extends ADOConnection { function SelectLimit($sql, $nrows = -1, $offset = -1, $inputArr = false, $secs2cache = 0) { - $nrows = (integer) $nrows; + $nrows = (int) $nrows; + $offset = (int) $offset; if ($offset <= 0) { // could also use " OPTIMIZE FOR $nrows ROWS " if ($nrows >= 0) $sql .= " FETCH FIRST $nrows ROWS ONLY "; @@ -627,9 +619,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 /* returns queryID or false */ function _query($sql,$inputarr=false) { - GLOBAL $php_errormsg; - if (isset($php_errormsg)) $php_errormsg = ''; - $this->_error = ''; + error_clear_last(); + $this->_errorMsg = ''; if ($inputarr) { if (is_array($sql)) { @@ -638,7 +629,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 $stmtid = db2_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; return false; } } @@ -675,15 +667,18 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2 if ($this->_haserrorfunctions) { $this->_errorMsg = ''; $this->_errorCode = 0; - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; + } } else { if ($this->_haserrorfunctions) { $this->_errorMsg = db2_stmt_errormsg(); $this->_errorCode = db2_stmt_error(); - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; + } } return $stmtid; } diff --git a/drivers/adodb-mssql.inc.php b/drivers/adodb-mssql.inc.php index de3c75ba..db99635b 100644 --- a/drivers/adodb-mssql.inc.php +++ b/drivers/adodb-mssql.inc.php @@ -245,6 +245,8 @@ class ADODB_mssql extends ADOConnection { function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; if ($nrows > 0 && $offset <= 0) { $sql = preg_replace( '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop." $nrows ",$sql); @@ -689,7 +691,12 @@ order by constraint_name, referenced_table_name, keyno"; $arr = $args; } - array_walk($arr, create_function('&$v', '$v = "CAST(" . $v . " AS VARCHAR(255))";')); + array_walk( + $arr, + function(&$value, $key) { + $value = "CAST(" . $value . " AS VARCHAR(255))"; + } + ); $s = implode('+',$arr); if (sizeof($arr) > 0) return "$s"; diff --git a/drivers/adodb-mssqlnative.inc.php b/drivers/adodb-mssqlnative.inc.php index f7b1e9f2..7551bdb9 100644 --- a/drivers/adodb-mssqlnative.inc.php +++ b/drivers/adodb-mssqlnative.inc.php @@ -526,7 +526,12 @@ class ADODB_mssqlnative extends ADOConnection { $arr = $args; } - array_walk($arr, create_function('&$v', '$v = "CAST(" . $v . " AS VARCHAR(255))";')); + array_walk( + $arr, + function(&$value, $key) { + $value = "CAST(" . $value . " AS VARCHAR(255))"; + } + ); $s = implode('+',$arr); if (sizeof($arr) > 0) return "$s"; diff --git a/drivers/adodb-mysql.inc.php b/drivers/adodb-mysql.inc.php index 2b7e1aec..cd7e4998 100644 --- a/drivers/adodb-mysql.inc.php +++ b/drivers/adodb-mysql.inc.php @@ -604,6 +604,8 @@ class ADODB_mysql extends ADOConnection { // parameters use PostgreSQL convention, not MySQL function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr =($offset>=0) ? ((integer)$offset)."," : ''; // jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220 if ($nrows < 0) $nrows = '18446744073709551615'; diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 82ad9af6..b694b8e3 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -745,6 +745,8 @@ class ADODB_mysqli extends ADOConnection { $inputarr = false, $secs = 0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr = ($offset >= 0) ? "$offset," : ''; if ($nrows < 0) $nrows = '18446744073709551615'; diff --git a/drivers/adodb-oci8.inc.php b/drivers/adodb-oci8.inc.php index 272a6625..b9595d20 100644 --- a/drivers/adodb-oci8.inc.php +++ b/drivers/adodb-oci8.inc.php @@ -706,6 +706,8 @@ END; */ function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; // Since the methods used to limit the number of returned rows rely // on modifying the provided SQL query, we can't work with prepared // statements so we just extract the SQL string. diff --git a/drivers/adodb-odbc.inc.php b/drivers/adodb-odbc.inc.php index 3c6cbb2c..52b26307 100644 --- a/drivers/adodb-odbc.inc.php +++ b/drivers/adodb-odbc.inc.php @@ -67,8 +67,6 @@ class ADODB_odbc extends ADOConnection { // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - if (!function_exists('odbc_connect')) return null; if (!empty($argDatabasename) && stristr($argDSN, 'Database=') === false) { @@ -78,10 +76,11 @@ class ADODB_odbc extends ADOConnection { $argDSN .= 'Database='.$argDatabasename; } - if (isset($php_errormsg)) $php_errormsg = ''; + error_clear_last(); if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode); - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; if (isset($this->connectStmt)) $this->Execute($this->connectStmt); return $this->_connectionID != false; @@ -90,12 +89,10 @@ class ADODB_odbc extends ADOConnection { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; if (!function_exists('odbc_connect')) return null; - if (isset($php_errormsg)) $php_errormsg = ''; - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + error_clear_last(); if ($this->debug && $argDatabasename) { ADOConnection::outp("For odbc PConnect(), $argDatabasename is not used. Place dsn in 1st parameter."); } @@ -103,7 +100,8 @@ 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); - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); @@ -529,8 +527,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od /* returns queryID or false */ function _query($sql,$inputarr=false) { - GLOBAL $php_errormsg; - if (isset($php_errormsg)) $php_errormsg = ''; + error_clear_last(); $this->_error = ''; if ($inputarr) { @@ -540,7 +537,8 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od $stmtid = odbc_prepare($this->_connectionID,$sql); if ($stmtid == false) { - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; return false; } } @@ -581,14 +579,18 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od if ($this->_haserrorfunctions) { $this->_errorMsg = ''; $this->_errorCode = 0; - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; + } } else { if ($this->_haserrorfunctions) { $this->_errorMsg = odbc_errormsg(); $this->_errorCode = odbc_error(); - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; + } else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; + } } return $stmtid; } diff --git a/drivers/adodb-odbc_mssql.inc.php b/drivers/adodb-odbc_mssql.inc.php index 974b3c95..bc28d261 100644 --- a/drivers/adodb-odbc_mssql.inc.php +++ b/drivers/adodb-odbc_mssql.inc.php @@ -274,6 +274,8 @@ order by constraint_name, referenced_table_name, keyno"; function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; if ($nrows > 0 && $offset <= 0) { $sql = preg_replace( '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop." $nrows ",$sql); diff --git a/drivers/adodb-odbc_oracle.inc.php b/drivers/adodb-odbc_oracle.inc.php index b594b60d..eb83c1ee 100644 --- a/drivers/adodb-odbc_oracle.inc.php +++ b/drivers/adodb-odbc_oracle.inc.php @@ -76,11 +76,10 @@ class ADODB_odbc_oracle extends ADODB_odbc { // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - - $php_errormsg = ''; + error_clear_last(); $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); - $this->_errorMsg = $php_errormsg; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); @@ -89,10 +88,10 @@ class ADODB_odbc_oracle extends ADODB_odbc { // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { - global $php_errormsg; - $php_errormsg = ''; + error_clear_last(); $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); - $this->_errorMsg = $php_errormsg; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; $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 fc1e32b4..6beec767 100644 --- a/drivers/adodb-odbtp.inc.php +++ b/drivers/adodb-odbtp.inc.php @@ -605,9 +605,8 @@ class ADODB_odbtp extends ADOConnection{ function _query($sql,$inputarr=false) { - global $php_errormsg; - - $this->_errorMsg = false; + error_clear_last(); + $this->_errorMsg = false; $this->_errorCode = false; if ($inputarr) { @@ -616,7 +615,8 @@ class ADODB_odbtp extends ADOConnection{ } else { $stmtid = @odbtp_prepare($sql,$this->_connectionID); if ($stmtid == false) { - $this->_errorMsg = $php_errormsg; + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : ''; return false; } } diff --git a/drivers/adodb-pdo_pgsql.inc.php b/drivers/adodb-pdo_pgsql.inc.php index d707d914..5ea81c2b 100644 --- a/drivers/adodb-pdo_pgsql.inc.php +++ b/drivers/adodb-pdo_pgsql.inc.php @@ -73,12 +73,14 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { - $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; - $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ''; - if ($secs2cache) - $rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); - else - $rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr); + $nrows = (int) $nrows; + $offset = (int) $offset; + $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; + $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ''; + if ($secs2cache) + $rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); + else + $rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr); return $rs; } diff --git a/drivers/adodb-pdo_sqlite.inc.php b/drivers/adodb-pdo_sqlite.inc.php index a1a9cc68..5cfdac66 100644 --- a/drivers/adodb-pdo_sqlite.inc.php +++ b/drivers/adodb-pdo_sqlite.inc.php @@ -54,13 +54,15 @@ class ADODB_pdo_sqlite extends ADODB_pdo { function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $parent = $this->pdoDriver; $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ($offset >= 0 ? ' LIMIT 999999999' : ''); - if ($secs2cache) - $rs = $parent->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); - else - $rs = $parent->Execute($sql."$limitStr$offsetStr",$inputarr); + if ($secs2cache) + $rs = $parent->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); + else + $rs = $parent->Execute($sql."$limitStr$offsetStr",$inputarr); return $rs; } diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php index 9fc73213..a94e84bd 100644 --- a/drivers/adodb-postgres7.inc.php +++ b/drivers/adodb-postgres7.inc.php @@ -109,6 +109,8 @@ class ADODB_postgres7 extends ADODB_postgres64 { // which makes obsolete the LIMIT limit,offset syntax function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : ''; $limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : ''; if ($secs2cache) diff --git a/drivers/adodb-sqlite.inc.php b/drivers/adodb-sqlite.inc.php index 05335f34..c86bb403 100644 --- a/drivers/adodb-sqlite.inc.php +++ b/drivers/adodb-sqlite.inc.php @@ -222,6 +222,8 @@ class ADODB_sqlite extends ADOConnection { function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ($offset >= 0 ? ' LIMIT 999999999' : ''); if ($secs2cache) { diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php index d38d5104..f09893c3 100644 --- a/drivers/adodb-sqlite3.inc.php +++ b/drivers/adodb-sqlite3.inc.php @@ -337,6 +337,8 @@ class ADODB_sqlite3 extends ADOConnection { function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ($offset >= 0 ? ' LIMIT 999999999' : ''); if ($secs2cache) { diff --git a/drivers/adodb-sybase.inc.php b/drivers/adodb-sybase.inc.php index 52e7ecb7..8604e24c 100644 --- a/drivers/adodb-sybase.inc.php +++ b/drivers/adodb-sybase.inc.php @@ -113,8 +113,11 @@ class ADODB_sybase extends ADOConnection { if ($this->_logsql) return $this->_errorMsg; if (function_exists('sybase_get_last_message')) $this->_errorMsg = sybase_get_last_message(); - else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : 'SYBASE error messages not supported on this platform'; + else { + $err = error_get_last(); + $this->_errorMsg = $err ? $err['message'] : 'SYBASE error messages not supported on this platform'; + } + return $this->_errorMsg; } diff --git a/drivers/adodb-text.inc.php b/drivers/adodb-text.inc.php index b9a588d4..8e11973f 100644 --- a/drivers/adodb-text.inc.php +++ b/drivers/adodb-text.inc.php @@ -255,8 +255,7 @@ class ADODB_text extends ADOConnection { $projtypes = array($this->_types[$i]); $projnames = array($n); - reset($where_arr); - while (list($k_a,$a) = each($where_arr)) { + foreach ($where_arr as $a) { if ($i == 0 && $this->_skiprow1) { $projarray[] = array($n); continue; |
