greenlion/PHP-SQL-Parser

JSON Data Type

Opened this issue · 0 comments

Hi your parser doesn't support JSON_TABLE.

`SELECT
    GROUP_CONCAT(IF(med_conditions.type_fw = 1, NULL, med_conditions.id) SEPARATOR ', ') AS factors
  , GROUP_CONCAT(IF(med_conditions.type_fw = 0, NULL, med_conditions.id) SEPARATOR ', ') AS works
FROM med_rules
LEFT JOIN  (
      select med_rules.id
      ,      factors_works.factor_work_id
      ,      0 AS type_fw
      FROM med_rules
      JOIN JSON_TABLE(med_rules.harmful_factors_works, "$[*]" COLUMNS (factor_work_id INT PATH "$[0]")) AS factors_works
    ) AS rules_factors_works ON (med_rules.id = rules_factors_works.id)
LEFT JOIN med_conditions ON(rules_factors_works.factor_work_id = med_conditions.id)

WHERE  med_rules.id = {{id}}

GROUP BY med_rules.id
LIMIT 1`

When processing a request with a parser, it ignores the contents of the function.
As a result:

`SELECT GROUP_CONCAT(IF(med_conditions.type_fw = 1, NULL, med_conditions.id) SEPARATOR ', ') AS factors,
       GROUP_CONCAT(IF(med_conditions.type_fw = 0, NULL, med_conditions.id) SEPARATOR ', ') AS works
FROM med_rules
         LEFT JOIN (SELECT med_rules.id, factors_works.factor_work_id, 0 AS type_fw
                    FROM med_rules
                             **INNER JOIN JSON_TABLE AS factors_works) AS rules_factors_works**
                   ON (med_rules.id = rules_factors_works.id)
         LEFT JOIN med_conditions ON (rules_factors_works.factor_work_id = med_conditions.id)
WHERE med_rules.id = {{id}}
GROUP BY med_rules.id
LIMIT 1`

Are there any plans to update the functionality? When can this be expected?