Skip to content

Doesn't parse DATE_ADD correctly #94

@GoogleCodeExporter

Description

@GoogleCodeExporter
When parsing a query with DATE_ADD in it the parser does not parse the second 
parameter correctly. 

eg. SELECT DATE_ADD(NOW(), INTERVAL 1 MONTH) AS next_month

the following is the result of the parse:

[SELECT] => Array
        (
            [0] => Array
                (
                    [expr_type] => function
                    [alias] => Array
                        (
                            [as] => 1
                            [name] => next_month
                            [base_expr] => AS next_month
                        )

                    [base_expr] => DATE_ADD
                    [sub_tree] => Array
                        (
                            [0] => Array
                                (
                                    [expr_type] => function
                                    [base_expr] => NOW
                                    [sub_tree] => 
                                )

                            [1] => Array
                                (
                                    [expr_type] => function
                                    [base_expr] => INTERVAL
                                    [sub_tree] => 
                                )

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

                            [3] => Array
                                (
                                    [expr_type] => function
                                    [base_expr] => MONTH
                                    [sub_tree] => 
                                )

                        )

                )

        )

As you can see the parser has incorrectly split up the second parameter of the 
DATE_ADD function.

Original issue reported on code.google.com by i...@theorganicagency.com on 5 Jul 2013 at 12:19

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions