PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » SQL_Parser » Bug #5755

Cannot handle select in form of tablename.*

Details

Submitted2005-10-22 16:34 UTC
Fromshannah at sfu dot ca
Assignedepte
StatusClosed
PackageSQL_Parser
PHP Version4.3.11
OSOS X
Roadmaps(Not assigned)

Comments

[2005-10-22 16:34 UTC] shannah at sfu dot ca

Description:
------------
Trying to parse:
select Courses.* from Courses, Student_Courses where
Courses.id=Student_Courses.courseid and
Student_Courses.studentid='10'

It reads 'Courses.*' as simply 'Courses.'

Test script:
---------------
require_once 'SQL/Parser.php';
$sql = "select Courses.* from Courses, Student_Courses where Courses.id=Student_Courses.courseid and Student_Courses.studentid='10'";

$parser = new SQL_Parser();
$struct = $parser->parse($sql);

print_r($struct['column_names']);

Expected result:
----------------
Array
(
[0] => Courses.*
)

Actual result:
--------------
Array
(
[0] => Courses.
)

[2005-12-02 02:03 UTC] epte at php dot net

Thank you for the test script. :)

[2006-01-12 21:55 UTC] epte at php dot net

I have figured out the testing framework around SQL_Parser and have added your test. In fact, there were several tests that were incorrectly being generated along the same lines as this bug. Those have also been fixed.

[2006-04-03 05:22 UTC] epte at php dot net

This is fixed. Closing.

Note that the correct behavior for this is not to have column_fields => Courses.*

Rather, the column_tables has the Courses portion, and column_fields is just *