cvs: pear /DB_DataObject DataObject.php

From: Date: Sat, 12 Mar 2005 03:28:20 +0000
Subject: cvs: pear /DB_DataObject DataObject.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-30230@lists.php.net to get a copy of this message
alan_k Fri Mar 11 22:28:20 2005 EDT Modified files: /pear/DB_DataObject DataObject.php Log: fix (or try again to) bug #3768 quoteIdentifier not used correctly with database_prefix http://cvs.php.net/diff.php/pear/DB_DataObject/DataObject.php?r1=1.334&r2=1.335&ty=u Index: pear/DB_DataObject/DataObject.php diff -u pear/DB_DataObject/DataObject.php:1.334 pear/DB_DataObject/DataObject.php:1.335 --- pear/DB_DataObject/DataObject.php:1.334 Fri Mar 11 22:12:00 2005 +++ pear/DB_DataObject/DataObject.php Fri Mar 11 22:28:20 2005 @@ -20,7 +20,7 @@ * @package DB_DataObject * @category DB * - * $Id: DataObject.php,v 1.334 2005/03/12 03:12:00 alan_k Exp $ + * $Id: DataObject.php,v 1.335 2005/03/12 03:28:20 alan_k Exp $ */ /* =========================================================================== @@ -2840,13 +2840,10 @@ $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']); - $database_prefix = in_array($DB->type,array('mysql','mysqli')) ? - $obj->_database . '.' : ''; - // not sure how portable adding database prefixes is.. $objTable = $quoteIdentifiers ? - $DB->quoteIdentifier($database_prefix . '.' . $obj->__table) : - $database_prefix . '.' . $obj->__table ; + $DB->quoteIdentifier($obj->__table) : + $obj->__table ; // add database prefix if they are different databases if ($database_prefix && ($obj->_database != $this->_database) && strlen($obj->_database )) { @@ -2879,10 +2876,20 @@ $tfield = $DB->quoteIdentifier($tfield); } // add database prefix if they are different databases - if ($database_prefix && ($obj->_database != $this->_database) && strlen($this->_database )) { - $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->_database) : $this->_database) . '.' . $table; - + // as far as we know only mysql supports database prefixes.. + if ( + in_array($DB->dsn['phptype'],array('mysql','mysqli')) && + ($obj->_database != $this->_database) && + strlen($obj->_database) + ) + { + // prefix database (quoted if neccessary..) + $objTable = ($quoteIdentifiers + ? $DB->quoteIdentifier($obj->_database) + : $obj->_database) + . '.' . $objTable; } + $fullJoinAs = ''; $addJoinAs = ($quoteIdentifiers ? $DB->quoteIdentifier($obj->__table) : $obj->__table) != $joinAs;

« previous php.pear.cvs (#30230) next »