1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-21 01:36:26 +02:00

applyLimit support

This commit is contained in:
David Grudl
2006-09-23 07:55:11 +00:00
parent da608c2db2
commit d705f4089d
8 changed files with 74 additions and 19 deletions

View File

@@ -176,22 +176,24 @@ class DibiMySqlDriver extends DibiDriver {
}
/*
// is this really needed?
/**
* @see DibiDriver::applyLimit()
*/
public function applyLimit(&$sql, $limit, $offset = 0)
{
if ($limit < 0 && $offset < 1) return;
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
$sql .= ' LIMIT ' . ($limit < 0 ? '18446744073709551615' : (int) $limit)
. ($offset > 0 ? ' OFFSET ' . (int) $offset : '');
}
/* is this really needed?
public function getResource()
{
return $this->conn;
}
// experimental
public function applyLimit(&$sql, $offset, $limit)
{
if ($limit > 0) {
$sql .= " LIMIT " . (int) $limit . ($offset > 0 ? " OFFSET " . (int) $offset : "");
} elseif ($offset > 0) {
$sql .= " LIMIT " . $offset . ", 18446744073709551615";
}
}
*/
} // DibiMySqlDriver