Skip to content

Commit

Permalink
[mms] Fix SplitRead driver to work with the recent blob changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Nov 6, 2014
1 parent 7c53eb2 commit cc43982
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
53 changes: 53 additions & 0 deletions framework/Db/lib/Horde/Db/Adapter/SplitRead.php
Expand Up @@ -362,6 +362,35 @@ public function insert($sql, $arg1 = null, $arg2 = null, $pk = null,
return $result;
}

/**
* Inserts a row including BLOBs into a table.
*
* @since Horde_Db 2.1.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 $pk The primary key column.
* @param integer $idValue The primary key value. This parameter is
* required if the primary key is inserted
* manually.
*
* @return integer Last inserted ID.
* @throws Horde_Db_Exception
*/
public function insertBlob($table, $fields, $pk = null, $idValue = null)
{
$result = $this->_write->insertBlob($table, $fields, $pk, $idValue);
$this->_lastQuery = $this->_write->getLastQuery();

// Once doing writes, keep using the write backend even for reads
// at least during the same request, to help against stale data.
$this->_read = $this->_write;

return $result;
}

/**
* Executes the update statement and returns the number of rows affected.
*
Expand All @@ -386,6 +415,30 @@ public function update($sql, $arg1 = null, $arg2 = null)
return $result;
}

/**
* Updates rows including BLOBs into a table.
*
* @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.
*
* @throws Horde_Db_Exception
*/
public function updateBlob($table, $fields, $where = '')
{
$result = $this->_write->updateBlob($table, $fields, $where);
$this->_lastQuery = $this->_write->getLastQuery();

// Once doing writes, keep using the write backend even for reads
// at least during the same request, to help against stale data.
$this->_read = $this->_write;

return $result;
}

/**
* Executes the delete statement and returns the number of rows affected.
*
Expand Down
4 changes: 2 additions & 2 deletions framework/Db/package.xml
Expand Up @@ -34,7 +34,7 @@
</stability>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
*
* [mms] Fix SplitRead driver to work with the recent blob changes.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -857,7 +857,7 @@
<date>2014-11-06</date>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
*
* [mms] Fix SplitRead driver to work with the recent blob changes.
</notes>
</release>
</changelog>
Expand Down

0 comments on commit cc43982

Please sign in to comment.