Skip to content

Commit

Permalink
Use Horde_Db_Adapter#insertBlob().
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jan 22, 2014
1 parent e0e42ab commit b286617
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
15 changes: 2 additions & 13 deletions framework/Vfs/lib/Horde/Vfs/Sql.php
Expand Up @@ -729,22 +729,11 @@ protected function _readBlob($table, $field, $criteria)
*/
protected function _insertBlob($table, $field, $data, $attributes)
{
$fields = $values = array();
foreach ($attributes as $key => $value) {
$fields[] = $key;
$values[] = $value;
}
$values[] = new Horde_Db_Value_Binary($data);

$query = sprintf('INSERT INTO %s (%s, %s) VALUES (%s)',
$table,
implode(', ', $fields),
$field,
'?' . str_repeat(', ?', count($fields)));
$attributes[$field] = new Horde_Db_Value_Binary($data);

/* Execute the query. */
try {
$this->_db->insert($query, $values);
$this->_db->insertBlob($table, $attributes);
} catch (Horde_Db_Exception $e) {
throw new Horde_Vfs_Exception($e);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/Vfs/package.xml
Expand Up @@ -439,7 +439,7 @@ Reading, writing and listing of files are all supported.</description>
<package>
<name>Horde_Db</name>
<channel>pear.horde.org</channel>
<min>2.0.3</min>
<min>2.1.0</min>
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
Expand Down

0 comments on commit b286617

Please sign in to comment.