1
0
mirror of synced 2025-02-01 04:51:45 +03:00

another identifier quoting fix

This commit is contained in:
zYne 2007-04-18 09:48:23 +00:00
parent c5eb26c3ba
commit 9862f45fc3

View File

@ -60,7 +60,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
/** /**
* @var array $savepoints an array containing all savepoints * @var array $savepoints an array containing all savepoints
*/ */
public $savePoints = array(); protected $savePoints = array();
/** /**
* getState * getState
* returns the state of this connection * returns the state of this connection
@ -129,10 +129,12 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$ids = array(); $ids = array();
if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) { if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) {
foreach($deletes as $k => $record) { foreach ($deletes as $k => $record) {
$cond = array(); $cond = array();
$ids = $record->obtainIdentifier(); $ids = $record->obtainIdentifier();
$query = 'DELETE FROM '.$record->getTable()->getTableName().' WHERE '; $query = 'DELETE FROM '
. $this->conn->quoteIdentifier($record->getTable()->getTableName())
. ' WHERE ';
foreach (array_keys($ids) as $id){ foreach (array_keys($ids) as $id){
$cond[] = $id . ' = ? '; $cond[] = $id . ' = ? ';
@ -147,10 +149,10 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$record->assignIdentifier(false); $record->assignIdentifier(false);
} }
if ($record instanceof Doctrine_Record) { if ($record instanceof Doctrine_Record) {
$params = substr(str_repeat("?, ",count($ids)),0,-2); $params = substr(str_repeat('?, ', count($ids)),0,-2);
$query = 'DELETE FROM ' $query = 'DELETE FROM '
. $record->getTable()->getTableName() . $this->conn->quoteIdentifier($record->getTable()->getTableName())
. ' WHERE ' . ' WHERE '
. $record->getTable()->getIdentifier() . $record->getTable()->getIdentifier()
. ' IN(' . $params . ')'; . ' IN(' . $params . ')';