PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB_QueryTool » Bug #10160

raw mode still quotes with MDB2

Details

Submitted2007-02-22 21:44 UTC
Frombbaumer at nymets dot com
Assignedhugoki
StatusClosed
PackageMDB_QueryTool
PHP Version5.2.0
OSWin XP
Roadmaps(Not assigned)

Comments

[2007-02-22 21:44 UTC] bbaumer at nymets dot com

Description:
------------
Maybe I'm an idiot, but the behavior of raw mode does not seem to work as expected with MDB2 (v. 2.3.0). I can't prevent it from quoting the SELECT field names. It looks to me like MDB2->quote() is the culprit, but why is it being called if "raw" is set to TRUE?

Test script:
---------------
require_once "MDB/QueryTool.php";
$dsn='mysqli://user:pass@localhost/bdb';
$query=new MDB_QueryTool($dsn,NULL,2);
$query->setOption('raw',true);
$query->setSelect("t.playerid, concat(namelast,', ',namefirst) as Name, sum(h)/sum(ab) as AVG");
$query->setTable("batting t");
$query->setLeftJoin("master m","m.playerid=t.playerid");
$query->setWhere("yearid=2006 and teamid='NYN'");
$query->setGroup("playerid");

print_r($query->options);
echo $query->getQueryString();
echo "<br>";
print_r($query->execute());

Expected result:
----------------
Array
(
[raw] => 1
[verbose] => 1
[useCache] =>
[logFile] =>
)
SELECT t.playerid,concat(namelast,',',namefirst) AS Name,sum(h)/sum(ab) AS `AVG` FROM batting t LEFT JOIN master m ON m.playerid=t.playerid WHERE yearid=2006 and teamid='NYN' GROUP BY batting t.playerid

Actual result:
--------------
Array
(
[raw] => 1
[verbose] => 1
[useCache] =>
[logFile] =>
)
SELECT t.`playerid`,`concat(namelast`,`'`,`'`,`namefirst)` AS Name,sum(h)/sum(ab) AS `AVG` FROM batting t LEFT JOIN master m ON m.playerid=t.playerid WHERE yearid=2006 and teamid='NYN' GROUP BY batting t.playerid

[2007-02-23 15:53 UTC] hugoki at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Works only with MDB2!