Update PicoDb

This commit is contained in:
Frédéric Guillot 2014-09-16 11:50:39 +02:00
parent 871f1d1d64
commit 77f3c7c57a
3 changed files with 13 additions and 2 deletions

View File

@ -7,6 +7,7 @@ function version_27($pdo)
$pdo->exec('ALTER TABLE config ADD COLUMN items_display_mode TEXT DEFAULT "summaries"'); $pdo->exec('ALTER TABLE config ADD COLUMN items_display_mode TEXT DEFAULT "summaries"');
} }
function version_26($pdo) function version_26($pdo)
{ {
$pdo->exec('ALTER TABLE config ADD COLUMN bookmarklet_token TEXT DEFAULT "'.\Model\Config\generate_token().'"'); $pdo->exec('ALTER TABLE config ADD COLUMN bookmarklet_token TEXT DEFAULT "'.\Model\Config\generate_token().'"');

View File

@ -78,6 +78,12 @@ class Database
} }
public function closeConnection()
{
$this->pdo = null;
}
public function escapeIdentifier($value) public function escapeIdentifier($value)
{ {
return $this->pdo->escapeIdentifier($value); return $this->pdo->escapeIdentifier($value);

View File

@ -44,7 +44,11 @@ class Table
} }
} }
/**
* Update
*
* Note: Do not use `rowCount()` the behaviour is different across drivers
*/
public function update(array $data) public function update(array $data)
{ {
$columns = array(); $columns = array();
@ -70,7 +74,7 @@ class Table
$result = $this->db->execute($sql, $values); $result = $this->db->execute($sql, $values);
return $result !== false && $result->rowCount() > 0; return $result !== false;
} }