thecodingmachine / magic-query

A very clever library to use SQL prepared statement with a variable number of parameters... and much more!
http://mouf-php.com/packages/mouf/magic-query/README.md
22 stars 14 forks source link

unknown [expr_type] = in-list in "expression subtree" [4] #54

Closed Arnex93 closed 5 years ago

Arnex93 commented 5 years ago

Hello, when I run this query :

SELECT company_relationship_history.* FROM company_relationship_history JOIN companies_relationship cr ON company_relationship_history.idcompany_relationship = cr.idcompany_relationship JOIN companies cFrom ON cr.from_idcompany = cFrom.idcompany JOIN companies cTo ON cr.to_idcompany = cTo.idcompany WHERE company_relationship_history.idcompany_relationship = :idcompany_relationship AND company_relationship_history.field = "status" ORDER BY FIELD(company_relationship_history.member,(CASE WHEN cFrom.idcompanytype IN (:id_retailers) THEN "from" ELSE "to" END), (CASE WHEN cFrom.idcompanytype IN (:id_retailers) THEN "to" ELSE "from" END)), company_relationship_history.history_date DESC

I got this error :

MESSAGE | PHPSQLParser\exceptions\UnableToCreateSQLException:unknown [expr_type] = in-list in "expression subtree" [4] LINE: 119 FUNCTION: PHPSQLParser\builders\SubTreeBuilder->build() FILE: /var/www/html/vendor/greenlion/php-sql-parser/src/PHPSQLParser/builders/SubTreeBuilder.php

moufmouf commented 5 years ago

This seems rather related to PHP-SQL-Parser (and the way it is used in TDBM). Closing this issue as it is not related to Magic-Query directly.