phpcr / phpcr-utils

A set of helper classes and command line commands you want to use with phpcr, but that are not part of the API itself
phpcr.github.io
Other
72 stars 30 forks source link

Sql2ToQomQueryConverter doesn't validate statements #4

Closed piotras closed 10 years ago

piotras commented 12 years ago

I am using this test: https://github.com/doctrine/phpcr-odm/blob/master/tests/Doctrine/Tests/ODM/PHPCR/Functional/QuerySql2Test.php#L22

And get this error: 1) Doctrine\Tests\ODM\PHPCR\Functional\QuerySql2Test::testQuery with data set #4 ('invalidstatement', -1) Argument 1 passed to Midgard\PHPCR\Query\QOM\QueryObjectModelFactory::createQuery() must implement interface PHPCR\Query\QOM\SourceInterface, null given, called in PHPCR/Util/QOM/Sql2ToQomQueryConverter.php on line 69 and defined

Midgard/PHPCR/src/Midgard/PHPCR/Query/QOM/QueryObjectModelFactory.php:12 jackalope/lib/phpcr-utils/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php:69 Midgard/PHPCR/src/Midgard/PHPCR/Query/SQLQuery.php:22

SQLQuery simply does:

$this->query = $this->converter->parse($statement);

where $statement is statement from odm test.

There's no way to catch any exception or validate query returned by converter's parse method.

dbu commented 11 years ago

this seems to be fixed: https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php#L103

@piotras anything missing or can we close this issue?