mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
removed unnecessary (int)
This commit is contained in:
@@ -313,7 +313,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
|||||||
{
|
{
|
||||||
if ($limit > 0 || $offset > 0) {
|
if ($limit > 0 || $offset > 0) {
|
||||||
// http://www.firebirdsql.org/refdocs/langrefupd20-select.html
|
// http://www.firebirdsql.org/refdocs/langrefupd20-select.html
|
||||||
$sql = 'SELECT ' . ($limit > 0 ? 'FIRST ' . (int) $limit : '') . ($offset > 0 ? ' SKIP ' . (int) $offset : '') . ' * FROM (' . $sql . ')';
|
$sql = 'SELECT ' . ($limit > 0 ? 'FIRST ' . $limit : '') . ($offset > 0 ? ' SKIP ' . $offset : '') . ' * FROM (' . $sql . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -270,7 +270,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||||
|
|
||||||
} elseif ($limit !== null) {
|
} elseif ($limit !== null) {
|
||||||
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ') t';
|
$sql = 'SELECT TOP ' . $limit . ' * FROM (' . $sql . ') t';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -355,8 +355,8 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
|
|
||||||
} elseif ($limit !== null || $offset) {
|
} elseif ($limit !== null || $offset) {
|
||||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : (int) $limit)
|
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
|
||||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -293,7 +293,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
|||||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||||
|
|
||||||
} elseif ($limit !== null) {
|
} elseif ($limit !== null) {
|
||||||
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ') t';
|
$sql = 'SELECT TOP ' . $limit . ' * FROM (' . $sql . ') t';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -321,11 +321,11 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
|||||||
} elseif ($offset) {
|
} elseif ($offset) {
|
||||||
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
||||||
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
||||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '')
|
. ($limit !== null ? 'WHERE ROWNUM <= ' . ($offset + $limit) : '')
|
||||||
. ') WHERE "__rnum" > ' . (int) $offset;
|
. ') WHERE "__rnum" > ' . $offset;
|
||||||
|
|
||||||
} elseif ($limit !== null) {
|
} elseif ($limit !== null) {
|
||||||
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
|
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . $limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -389,24 +389,24 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
case 'mysql':
|
case 'mysql':
|
||||||
if ($limit !== null || $offset) {
|
if ($limit !== null || $offset) {
|
||||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : (int) $limit)
|
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
|
||||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
if ($limit !== null) {
|
if ($limit !== null) {
|
||||||
$sql .= ' LIMIT ' . (int) $limit;
|
$sql .= ' LIMIT ' . $limit;
|
||||||
}
|
}
|
||||||
if ($offset) {
|
if ($offset) {
|
||||||
$sql .= ' OFFSET ' . (int) $offset;
|
$sql .= ' OFFSET ' . $offset;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
if ($limit !== null || $offset) {
|
if ($limit !== null || $offset) {
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : (int) $limit)
|
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
||||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -414,11 +414,11 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
if ($offset) {
|
if ($offset) {
|
||||||
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
||||||
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
||||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '')
|
. ($limit !== null ? 'WHERE ROWNUM <= ' . ($offset + $limit) : '')
|
||||||
. ') WHERE "__rnum" > ' . (int) $offset;
|
. ') WHERE "__rnum" > ' . $offset;
|
||||||
|
|
||||||
} elseif ($limit !== null) {
|
} elseif ($limit !== null) {
|
||||||
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
|
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . $limit;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
throw new Dibi\NotSupportedException('Offset is not supported by this database.');
|
throw new Dibi\NotSupportedException('Offset is not supported by this database.');
|
||||||
|
|
||||||
} elseif ($limit !== null) {
|
} elseif ($limit !== null) {
|
||||||
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ') t';
|
$sql = 'SELECT TOP ' . $limit . ' * FROM (' . $sql . ') t';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// break omitted
|
// break omitted
|
||||||
|
@@ -364,10 +364,10 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
|||||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||||
}
|
}
|
||||||
if ($limit !== null) {
|
if ($limit !== null) {
|
||||||
$sql .= ' LIMIT ' . (int) $limit;
|
$sql .= ' LIMIT ' . $limit;
|
||||||
}
|
}
|
||||||
if ($offset) {
|
if ($offset) {
|
||||||
$sql .= ' OFFSET ' . (int) $offset;
|
$sql .= ' OFFSET ' . $offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -308,8 +308,8 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||||
|
|
||||||
} elseif ($limit !== null || $offset) {
|
} elseif ($limit !== null || $offset) {
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : (int) $limit)
|
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
||||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user