Skip to content

Commit

Permalink
Merge pull request bcit-ci#1133 from SammyK/develop
Browse files Browse the repository at this point in the history
Fixed bug for PostgreSQL driver where limit() & order_by() throws error
  • Loading branch information
narfbg committed Mar 5, 2012
2 parents 5674745 + 92d68cc commit 3018c96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
10 changes: 1 addition & 9 deletions system/database/drivers/postgre/postgre_driver.php
Expand Up @@ -587,16 +587,10 @@ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
$valstr[] = $key." = ".$val;
}

$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;

$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';

$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);

$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';

$sql .= $orderby.$limit;

return $sql;
}

Expand Down Expand Up @@ -647,9 +641,7 @@ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
$conditions .= implode("\n", $like);
}

$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;

return "DELETE FROM ".$table.$conditions.$limit;
return "DELETE FROM ".$table.$conditions;
}

// --------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Expand Up @@ -63,6 +63,7 @@ Release Date: Not Released
- Added db_set_charset() support.
- Added _optimize_table() support for the :doc:`Database Utility Class <database/utilities>` (rebuilds table indexes).
- Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
- Removed limit() and order_by() support for UPDATE and DELETE queries in PostgreSQL driver. Postgres does not support those features.

- Libraries

Expand Down

0 comments on commit 3018c96

Please sign in to comment.