mirror of
https://github.com/dg/dibi.git
synced 2025-08-03 12:47:33 +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) {
|
||||
// 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.');
|
||||
|
||||
} 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) {
|
||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : (int) $limit)
|
||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
|
||||
. ($offset ? ' OFFSET ' . $offset : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -293,7 +293,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
||||
} 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) {
|
||||
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
||||
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '')
|
||||
. ') WHERE "__rnum" > ' . (int) $offset;
|
||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ($offset + $limit) : '')
|
||||
. ') WHERE "__rnum" > ' . $offset;
|
||||
|
||||
} 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':
|
||||
if ($limit !== null || $offset) {
|
||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : (int) $limit)
|
||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
|
||||
. ($offset ? ' OFFSET ' . $offset : '');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'pgsql':
|
||||
if ($limit !== null) {
|
||||
$sql .= ' LIMIT ' . (int) $limit;
|
||||
$sql .= ' LIMIT ' . $limit;
|
||||
}
|
||||
if ($offset) {
|
||||
$sql .= ' OFFSET ' . (int) $offset;
|
||||
$sql .= ' OFFSET ' . $offset;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
if ($limit !== null || $offset) {
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : (int) $limit)
|
||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
||||
. ($offset ? ' OFFSET ' . $offset : '');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -414,11 +414,11 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
if ($offset) {
|
||||
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
|
||||
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
|
||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '')
|
||||
. ') WHERE "__rnum" > ' . (int) $offset;
|
||||
. ($limit !== null ? 'WHERE ROWNUM <= ' . ($offset + $limit) : '')
|
||||
. ') WHERE "__rnum" > ' . $offset;
|
||||
|
||||
} elseif ($limit !== null) {
|
||||
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
|
||||
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . $limit;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -441,7 +441,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
throw new Dibi\NotSupportedException('Offset is not supported by this database.');
|
||||
|
||||
} elseif ($limit !== null) {
|
||||
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ') t';
|
||||
$sql = 'SELECT TOP ' . $limit . ' * FROM (' . $sql . ') t';
|
||||
break;
|
||||
}
|
||||
// break omitted
|
||||
|
@@ -364,10 +364,10 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
}
|
||||
if ($limit !== null) {
|
||||
$sql .= ' LIMIT ' . (int) $limit;
|
||||
$sql .= ' LIMIT ' . $limit;
|
||||
}
|
||||
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.');
|
||||
|
||||
} elseif ($limit !== null || $offset) {
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : (int) $limit)
|
||||
. ($offset ? ' OFFSET ' . (int) $offset : '');
|
||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
||||
. ($offset ? ' OFFSET ' . $offset : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user