summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/adodb-borland_ibase.inc.php2
-rw-r--r--drivers/adodb-csv.inc.php4
-rw-r--r--drivers/adodb-db2.inc.php3
-rw-r--r--drivers/adodb-mssql.inc.php2
-rw-r--r--drivers/adodb-mysql.inc.php2
-rw-r--r--drivers/adodb-mysqli.inc.php2
-rw-r--r--drivers/adodb-oci8.inc.php2
-rw-r--r--drivers/adodb-odbc_mssql.inc.php2
-rw-r--r--drivers/adodb-pdo_pgsql.inc.php14
-rw-r--r--drivers/adodb-pdo_sqlite.inc.php10
-rw-r--r--drivers/adodb-postgres7.inc.php2
-rw-r--r--drivers/adodb-sqlite.inc.php2
-rw-r--r--drivers/adodb-sqlite3.inc.php2
13 files changed, 37 insertions, 12 deletions
diff --git a/drivers/adodb-borland_ibase.inc.php b/drivers/adodb-borland_ibase.inc.php
index 05fb4607..70c30fbb 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 5ac23fce..61fad92a 100644
--- a/drivers/adodb-csv.inc.php
+++ b/drivers/adodb-csv.inc.php
@@ -83,8 +83,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 eacecd29..c42fef69 100644
--- a/drivers/adodb-db2.inc.php
+++ b/drivers/adodb-db2.inc.php
@@ -234,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 ";
diff --git a/drivers/adodb-mssql.inc.php b/drivers/adodb-mssql.inc.php
index a6d4c6b4..da3791c1 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);
diff --git a/drivers/adodb-mysql.inc.php b/drivers/adodb-mysql.inc.php
index ebe6dbc1..732acff6 100644
--- a/drivers/adodb-mysql.inc.php
+++ b/drivers/adodb-mysql.inc.php
@@ -585,6 +585,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 ceec44f5..617eccdf 100644
--- a/drivers/adodb-mysqli.inc.php
+++ b/drivers/adodb-mysqli.inc.php
@@ -713,6 +713,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 bedc81cb..75593569 100644
--- a/drivers/adodb-oci8.inc.php
+++ b/drivers/adodb-oci8.inc.php
@@ -709,6 +709,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_mssql.inc.php b/drivers/adodb-odbc_mssql.inc.php
index 5d51126e..65637d5b 100644
--- a/drivers/adodb-odbc_mssql.inc.php
+++ b/drivers/adodb-odbc_mssql.inc.php
@@ -280,6 +280,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-pdo_pgsql.inc.php b/drivers/adodb-pdo_pgsql.inc.php
index 2fc2ad40..111d9efa 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 82bf9c15..524de31e 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 90ba0a47..33b8adf7 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 bb197707..5996e712 100644
--- a/drivers/adodb-sqlite.inc.php
+++ b/drivers/adodb-sqlite.inc.php
@@ -226,6 +226,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 7c8ceee4..e957fcc4 100644
--- a/drivers/adodb-sqlite3.inc.php
+++ b/drivers/adodb-sqlite3.inc.php
@@ -209,6 +209,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) {