Memcache, refactoring, View helpers, #16

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@124 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2010-03-13 23:33:46 +00:00
parent 4a22759e3d
commit 8fc917dca2
19 changed files with 706 additions and 147 deletions

View File

@ -15,6 +15,28 @@
class MySQLiDriver extends DbDriver
{
public function insert($table, $bind, $on_duplicate = array())
{
$columns = array();
foreach ($bind as $col => $val) {
$columns[] = $this->quoteIdentifier($col);
}
$values = array_values($bind);
if ($on_duplicate) {
$update = array();
foreach ($on_duplicate as $col => $val) {
$update[] = $this->quoteIdentifier($col) . '=' . $this->quote($val);
}
$on_duplicate = ' ON DUPLICATE KEY UPDATE ' . implode(', ', $update);
}
$sql = 'INSERT INTO ' . $this->quoteIdentifier($table)
. ' (' . implode(', ', $columns) . ') VALUES (' . $this->quote($values) . ')'
. (($on_duplicate) ? $on_duplicate : '');
return $this->query($sql)->affectedRows();
}
/**
* @param mixed $sql
* @return DbStatement
@ -72,7 +94,6 @@ class MySQLiDriver extends DbDriver
}
if (is_bool($value)) {
var_dump($value);
return (int) $value;
}