cvs: pear /DB_QueryTool/QueryTool Query.php
| From: | Wolfram Kriesing | Date: | Fri, 04 Apr 2003 18:11:49 +0000 |
| Subject: | cvs: pear /DB_QueryTool/QueryTool Query.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-9741@lists.php.net to get a copy of this message | ||
cain Fri Apr 4 13:11:49 2003 EDT
Modified files:
/pear/DB_QueryTool/QueryTool Query.php
Log:
- bugfix in building joined query
Index: pear/DB_QueryTool/QueryTool/Query.php
diff -u pear/DB_QueryTool/QueryTool/Query.php:1.13 pear/DB_QueryTool/QueryTool/Query.php:1.14
--- pear/DB_QueryTool/QueryTool/Query.php:1.13 Fri Mar 14 15:34:38 2003
+++ pear/DB_QueryTool/QueryTool/Query.php Fri Apr 4 13:11:49 2003
@@ -15,7 +15,7 @@
// | Author: Wolfram Kriesing, Paolo Panto, vision:produktion <wk@visionp.de>
// +----------------------------------------------------------------------+
//
-// $Id: Query.php,v 1.13 2003/03/14 20:34:38 cain Exp $
+// $Id: Query.php,v 1.14 2003/04/04 18:11:49 cain Exp $
//
require_once 'PEAR.php';
@@ -1369,11 +1369,14 @@
if ($this->getJoin()) {
// replace all 'column' by '$this->table.column' to prevent
ambigious errors
- foreach( $this->metadata() as $aCol=>$x )
- {
+ foreach ($this->metadata() as $aCol=>$x) {
// handle ',id as xid,MAX(id),id' etc.
// FIXXME do this better!!!
- $what =
preg_replace("/(^|,|\()\s*$aCol(\)|\s*|,|as)/i","$1{$this->table}.$aCol$2",$what);
+ $what = preg_replace( "/(^|,|\()(\s*)$aCol(\)|\s|,|as)/i",
+ // $2 is actually just to keep the spaces, is not really
+ // necessary, but this way the test works independent of
this functionality here
+ "$1$2{$this->table}.$aCol$3",
+ $what);
}
// replace all 'joinedTable.columnName' by
'_joinedTable_columnName'