rickywu-posh / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

USE Key word doesn't work with JOINs #140

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
SELECT * FROM tbl_name AS tbl_alias USE KEY (tbl_column) JOIN tbl_join AS 
join_alias ON tbl_alias.catid = join_alias.id

This query returns:
Array
(
    [SELECT] => Array
        (
            [0] => Array
                (
                    [expr_type] => colref
                    [alias] =>
                    [base_expr] => *
                    [sub_tree] =>
                    [delim] =>
                )

        )

    [FROM] => Array
        (
            [0] => Array
                (
                    [expr_type] => table
                    [table] => tbl_name
                    [no_quotes] => tbl_name
                    [alias] => Array
                        (
                            [as] => 1
                            [name] => tbl_alias
                            [base_expr] => AS tbl_alias
                            [no_quotes] => tbl_alias
                        )

                    [join_type] => JOIN
                    [ref_type] =>
                    [ref_clause] =>
                    [base_expr] => tbl_name AS tbl_alias
                    [sub_tree] =>
                )

        )

    [USE] => Array
        (
            [0] => USE
            [1] => KEY
            [2] =>
            [3] => (tbl_column)
            [4] =>
            [5] => JOIN
            [6] =>
            [7] => tbl_join
            [8] =>
            [9] => AS
            [10] =>
            [11] => join_alias
            [12] =>
            [13] => ON
            [14] =>
            [15] => tbl_alias.catid
            [16] =>
            [17] => =
            [18] =>
            [19] => join_alias.id
        )

)

What is the expected output? What do you see instead?
The correct JOIN separation

What version of the product are you using? On what operating system?
c162c6458e (lastest today)

Original issue reported on code.google.com by h.leith...@gmail.com on 9 May 2014 at 3:20

GoogleCodeExporter commented 8 years ago
The "use key" is part of index hints, which are not fully supported by the 
parser.

Original comment by pho...@gmx.de on 15 Sep 2014 at 10:43