Skip to content

Commit

Permalink
Allow $where to be specified as bind parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Nov 6, 2014
1 parent 330d89b commit 359b801
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
17 changes: 12 additions & 5 deletions framework/Db/lib/Horde/Db/Adapter/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,22 @@ public function update($sql, $arg1 = null, $arg2 = null)
*
* @since Horde_Db 2.2.0
*
* @param string $table The table name.
* @param array $fields A hash of column names and values. BLOB columns
* must be provided as Horde_Db_Value_Binary objects.
* @param string $where A WHERE clause.
* @param string $table The table name.
* @param array $fields A hash of column names and values. BLOB
* columns must be provided as
* Horde_Db_Value_Binary objects.
* @param string|array $where A WHERE clause. Either a complete clause or
* an array containing a clause with
* placeholders and a list of values.
*
* @throws Horde_Db_Exception
*/
public function updateBlob($table, $fields, $where = '')
public function updateBlob($table, $fields, $where = null)
{
if (is_array($where)) {
$where = $this->_replaceParameters($where[0], $where[1]);
}

$query = sprintf(
'UPDATE %s SET %s%s',
$this->quoteTableName($table),
Expand Down
17 changes: 12 additions & 5 deletions framework/Db/lib/Horde/Db/Adapter/Oci8.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,24 @@ public function insertBlob($table, $fields, $pk = null, $idValue = null)
*
* @since Horde_Db 2.2.0
*
* @param string $table The table name.
* @param array $fields A hash of column names and values. BLOB columns
* must be provided as Horde_Db_Value_Binary objects.
* @param string $where A WHERE clause.
* @param string $table The table name.
* @param array $fields A hash of column names and values. BLOB
* columns must be provided as
* Horde_Db_Value_Binary objects.
* @param string|array $where A WHERE clause. Either a complete clause or
* an array containing a clause with
* placeholders and a list of values.
*
* @throws Horde_Db_Exception
*/
public function updateBlob($table, $fields, $where = '')
public function updateBlob($table, $fields, $where = null)
{
list($fields, $blobs, $locators) = $this->_prepareBlobs($fields);

if (is_array($where)) {
$where = $this->_replaceParameters($where[0], $where[1]);
}

$sql = 'UPDATE ' . $this->quoteTableName($table) . ' SET '
. implode(
', ',
Expand Down

0 comments on commit 359b801

Please sign in to comment.