From eefc11931ea45f76e1d11a38bac3a3c6aa735e31 Mon Sep 17 00:00:00 2001 From: dantleech Date: Mon, 15 Apr 2013 13:55:55 +0100 Subject: [PATCH 1/2] [WIP] Added test for DateTime objectrs in QOM query Not really sure how this works. .. --- tests/06_Query/QOM/QomTestQueries.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/06_Query/QOM/QomTestQueries.php b/tests/06_Query/QOM/QomTestQueries.php index 0bf3d042..c88773bf 100644 --- a/tests/06_Query/QOM/QomTestQueries.php +++ b/tests/06_Query/QOM/QomTestQueries.php @@ -402,6 +402,17 @@ public static function getQueries(\PHPCR\Query\QOM\QueryObjectModelFactoryInterf array(), array()); + // SELECT * FROM nt:unstructured WHERE sel.prop > '2013-04-15' + $queries['6.7.27.1.PropertyValue'] = + $factory->createQuery( + $factory->selector('nt:unstructured'), + $factory->comparison( + $factory->propertyValue('prop', 'sel'), + Constants::JCR_OPERATOR_GREATER_THAN, + $factory->literal(new \DateTime('2013-04-15'))), + array(), + array()); + /** * 6.7.28. Length */ From 5bda345083c66111432ee23699172d68c31d288f Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Wed, 9 Oct 2013 17:29:58 +0200 Subject: [PATCH 2/2] fix tests --- tests/06_Query/QOM/QomTestQueries.php | 6 +++--- tests/06_Query/QOM/Sql2TestQueries.php | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/06_Query/QOM/QomTestQueries.php b/tests/06_Query/QOM/QomTestQueries.php index c88773bf..c112cb6b 100644 --- a/tests/06_Query/QOM/QomTestQueries.php +++ b/tests/06_Query/QOM/QomTestQueries.php @@ -405,11 +405,11 @@ public static function getQueries(\PHPCR\Query\QOM\QueryObjectModelFactoryInterf // SELECT * FROM nt:unstructured WHERE sel.prop > '2013-04-15' $queries['6.7.27.1.PropertyValue'] = $factory->createQuery( - $factory->selector('nt:unstructured'), + $factory->selector('sel', 'nt:unstructured'), $factory->comparison( - $factory->propertyValue('prop', 'sel'), + $factory->propertyValue('sel', 'prop'), Constants::JCR_OPERATOR_GREATER_THAN, - $factory->literal(new \DateTime('2013-04-15'))), + $factory->literal(new \DateTime('2013-04-15 +02:00'))), array(), array()); diff --git a/tests/06_Query/QOM/Sql2TestQueries.php b/tests/06_Query/QOM/Sql2TestQueries.php index b389dce1..b4bf53e7 100644 --- a/tests/06_Query/QOM/Sql2TestQueries.php +++ b/tests/06_Query/QOM/Sql2TestQueries.php @@ -144,9 +144,10 @@ public static function getQueries() ); /** - * 6.7.27. ProperyValue + * 6.7.27. PropertyValue */ $queries['6.7.27.PropertyValue'] = 'SELECT * FROM [nt:file] AS file WHERE file.prop LIKE \'literal\''; + $queries['6.7.27.1.PropertyValue'] = 'SELECT * FROM [nt:unstructured] AS sel WHERE sel.prop > CAST(\'2013-04-15T00:00:00.000+02:00\' AS DATE)'; /** * 6.7.28. Length