diff options
author | Derek Allard <derek.allard@ellislab.com> | 2007-12-19 16:01:55 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2007-12-19 16:01:55 +0100 |
commit | e77d77c6b4c094483a3d85b23845436b77796d07 (patch) | |
tree | 616c036495ba4f76aeb9f8f964e0f549980ef691 /system/database/drivers | |
parent | da6d240d7b8615b5ae628496c42cb216658eb6e4 (diff) |
Added support for limit() into update() and delete() statements in Active Record.
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/mssql/mssql_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/odbc/odbc_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 6 | ||||
-rw-r--r-- | system/database/drivers/sqlite/sqlite_driver.php | 6 |
7 files changed, 28 insertions, 14 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 613be69b5..044fb3ced 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -445,9 +445,11 @@ class CI_DB_mssql_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index aaa9cc635..cd86ebf52 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -463,9 +463,11 @@ class CI_DB_mysql_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index f6f106eba..ebed81390 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -456,9 +456,11 @@ class CI_DB_mysqli_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 1dd157cca..c4ab70051 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -559,9 +559,11 @@ class CI_DB_oci8_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 66d5f89b9..040ffed9e 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -418,9 +418,11 @@ class CI_DB_odbc_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 076d87a58..88f08b2d7 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -447,9 +447,11 @@ class CI_DB_postgre_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index b701d6b96..6189b1ff0 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -442,9 +442,11 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the where clause
* @return string
*/
- function _delete($table, $where)
+ function _delete($table, $where, $limit = FALSE)
{
- return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------
|