fixed identifier quoting for update()
This commit is contained in:
parent
9862f45fc3
commit
26a723e81d
@ -259,7 +259,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
|
|||||||
}
|
}
|
||||||
$set = array();
|
$set = array();
|
||||||
foreach ($array as $name => $value) {
|
foreach ($array as $name => $value) {
|
||||||
$set[] = $name." = ?";
|
$set[] = $name . ' = ?';
|
||||||
|
|
||||||
if ($value instanceof Doctrine_Record) {
|
if ($value instanceof Doctrine_Record) {
|
||||||
switch ($value->state()) {
|
switch ($value->state()) {
|
||||||
@ -269,9 +269,9 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
|
|||||||
default:
|
default:
|
||||||
$array[$name] = $value->getIncremented();
|
$array[$name] = $value->getIncremented();
|
||||||
$record->set($name, $value->getIncremented());
|
$record->set($name, $value->getIncremented());
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$params = array_values($array);
|
$params = array_values($array);
|
||||||
$id = $record->obtainIdentifier();
|
$id = $record->obtainIdentifier();
|
||||||
@ -282,7 +282,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
|
|||||||
$id = array_values($id);
|
$id = array_values($id);
|
||||||
$params = array_merge($params, $id);
|
$params = array_merge($params, $id);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $record->getTable()->getTableName()
|
$sql = 'UPDATE ' . $this->conn->quoteIdentifier($record->getTable()->getTableName())
|
||||||
. ' SET ' . implode(', ', $set)
|
. ' SET ' . implode(', ', $set)
|
||||||
. ' WHERE ' . implode(' = ? AND ', $record->getTable()->getPrimaryKeys())
|
. ' WHERE ' . implode(' = ? AND ', $record->getTable()->getPrimaryKeys())
|
||||||
. ' = ?';
|
. ' = ?';
|
||||||
|
Loading…
Reference in New Issue
Block a user