PHP-SQL-Parser icon indicating copy to clipboard operation
PHP-SQL-Parser copied to clipboard

Tables in FROM surrounded by back-ticks are parsed with backticks

Open xRahul opened this issue 9 years ago • 1 comments

SELECT * FROM `asdf`, qwer;

In above, tables are parsed as-

`asdf`
qwer

xRahul avatar Jan 09 '17 07:01 xRahul

Pretty sure this is as expected, and similar to how quotes are handled elsewhere. Check the [no_quotes][parts] array for the "real" name:

    [FROM] => Array
        (
            [0] => Array
                (
                    [expr_type] => table
                    [table] => `asdf`
                    [no_quotes] => Array
                        (
                            [delim] => 
                            [parts] => Array
                                (
                                    [0] => asdf
                                )

                        )

                    [alias] => 
                    [hints] => 
                    [join_type] => JOIN
                    [ref_type] => 
                    [ref_clause] => 
                    [base_expr] => `asdf`
                    [sub_tree] => 
                )

            [1] => Array
                (
                    [expr_type] => table
                    [table] => qwer
                    [no_quotes] => Array
                        (
                            [delim] => 
                            [parts] => Array
                                (
                                    [0] => qwer
                                )

                        )

                    [alias] => 
                    [hints] => 
                    [join_type] => CROSS
                    [ref_type] => 
                    [ref_clause] => 
                    [base_expr] => qwer
                    [sub_tree] => 
                )

        )

dafeder avatar Oct 18 '21 14:10 dafeder