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

Fails on comments #146

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
            SELECT
                Category.id AS `Category.cat_id`,
                Category.title AS `Category.title`,
                Category.path AS `Category.path`,
                IF(CategoryListingCount.listing_count > 0,CategoryListingCount.listing_count,0) AS `Category.listing_count`,
                Category.alias AS `Category.slug`,
                Category.level AS `Category.level`,
                Category.params AS `Category.params`,
                Category.parent_id AS `Category.parent_id`,
                JreviewsCategory.criteriaid AS `Category.criteria_id`,
                JreviewsCategory.tmpl AS `Category.tmpl`,
                JreviewsCategory.tmpl_suffix AS `Category.tmpl_suffix`,
                Directory.id AS `Directory.dir_id`,
                Directory.desc AS `Directory.title`,
                Directory.title AS `Directory.slug`,
                ListingType.config AS `ListingType.config`
            FROM
                #__categories AS Category
             LEFT JOIN 
                (
                    SELECT
                        ParentCategory.id, COUNT(Listing.id) as listing_count
                    FROM
                        #__categories AS Category,
                        #__categories AS ParentCategory,
                        #__content AS Listing
                    WHERE
                         Category.lft BETWEEN ParentCategory.lft AND ParentCategory.rgt
                        AND Category.id IN (SELECT id FROM #__jreviews_categories WHERE `option` = "com_content")
                        AND Category.id = Listing.catid
                        AND Category.extension = "com_content"
                        AND Category.level > 0
                         AND (Category.path = "musicas" OR Category.path LIKE "musicas/%")

                            AND Listing.state = 1
                            AND ( Listing.publish_up = "0000-00-00 00:00:00" OR Listing.publish_up <= "2014-07-31 23:00:00" )
                            AND ( Listing.publish_down = "0000-00-00 00:00:00" OR Listing.publish_down >= "2014-07-30 23:00:00" )

                    GROUP BY
                        ParentCategory.id
                ) AS CategoryListingCount ON CategoryListingCount.id = Category.id

            INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.id = JreviewsCategory.id AND JreviewsCategory.option = "com_content"

            LEFT JOIN #__jreviews_directories AS Directory ON JreviewsCategory.dirid = Directory.id

            LEFT JOIN #__jreviews_criteria AS ListingType ON JreviewsCategory.criteriaid = ListingType.id

            WHERE 1 = 1 AND (
               Category.published = 1
               AND Category.extension = "com_content"
                AND (Category.path = "musicas" OR Category.path LIKE "musicas/%")
                AND Category.level <= 2

             )

            ORDER BY
                Category.lft
                # Removed directory from order by because it makes the query SLOW
                # Instead we run a much faster query below to re-order the output array
             , loadAssocList, Category.cat_id

What is the expected output? What do you see instead?
The parsed tree has a [expr_type] => reserved that could not be build.

Please provide any additional information below.
if you remove the 2 lines with # comments it looks fine.

Original issue reported on code.google.com by h.leith...@gmail.com on 31 Jul 2014 at 2:35

GoogleCodeExporter commented 8 years ago
#__ should be replaced with prefix_ 

Original comment by h.leith...@gmail.com on 31 Jul 2014 at 4:08

GoogleCodeExporter commented 8 years ago
There is no comment support at the moment. Please remove all comment lines from 
the statement first. See issue 56.

Original comment by pho...@gmx.de on 15 Sep 2014 at 7:04

GoogleCodeExporter commented 8 years ago

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