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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user