vikramkakar / 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

<> in split_sql() wont split #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
select * from test where value<>"brainstorm"

Suggestion
i removed the "|([^ ,]+)" from the preg_split(),
fixed this problem for me, but don't know if it is breaking somthing.

What is the expected output?
    [WHERE] => Array
        (
            [0] => Array
                (
                    [expr_type] => colref
                    [base_expr] => value
                    [sub_tree] => 
                )

            [1] => Array
                (
                    [expr_type] => operator
                    [base_expr] => <>
                    [sub_tree] => 
                )

            [2] => Array
                (
                    [expr_type] => const
                    [base_expr] => "brainstorm"
                    [sub_tree] => 
                )

        )

What do you see instead?
    [WHERE] => Array
        (
            [0] => Array
                (
                    [expr_type] => colref
                    [base_expr] => value
                    [sub_tree] => 
                )

            [1] => Array
                (
                    [expr_type] => colref
                    [base_expr] => <>"brainstorm"
                    [sub_tree] => 
                )

        )

Original issue reported on code.google.com by ralph.mo...@gmail.com on 2 Mar 2011 at 1:20

GoogleCodeExporter commented 8 years ago
Fixed in SVN.

I added <> to the list of operators to explicitly split on:
-|(\+|-|\*|\/|!=|&&|\|\||=|\^)
+|(\+|-|\*|\/|!=|<>|&&|\|\||=|\^)

Original comment by greenlion@gmail.com on 21 Mar 2011 at 4:45

GoogleCodeExporter commented 8 years ago

Original comment by greenlion@gmail.com on 30 Apr 2011 at 4:49