@@ -13,8 +13,12 @@ class QuerySql2OperationsTest extends QueryBaseCase
1313 public function testQueryField ()
1414 {
1515 /** @var $query QueryInterface */
16- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
17- 'SELECT foo FROM [nt:unstructured] WHERE foo = "bar" ' ,
16+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
17+ SELECT foo
18+ FROM [nt:unstructured]
19+ WHERE foo = "bar"
20+ AND (ISSAMENODE([/tests_general_base]) OR ISDESCENDANTNODE([/tests_general_base]))
21+ ' ,
1822 QueryInterface::JCR_SQL2
1923 );
2024
@@ -37,8 +41,11 @@ public function testQueryField()
3741 public function testQueryFieldSomenull ()
3842 {
3943 /** @var $query QueryInterface */
40- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
41- 'SELECT foo FROM [nt:unstructured] ' ,
44+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
45+ SELECT foo
46+ FROM [nt:unstructured]
47+ WHERE ISDESCENDANTNODE([/tests_general_base])
48+ ' ,
4249 QueryInterface::JCR_SQL2
4350 );
4451
@@ -50,21 +57,25 @@ public function testQueryFieldSomenull()
5057 $ vals [] = ($ node ->hasProperty ('foo ' ) ? $ node ->getPropertyValue ('foo ' ) : null );
5158 }
5259 $ this ->assertContains ('bar ' , $ vals );
53- $ this ->assertEquals (10 , count ($ vals ));
60+ $ this ->assertEquals (9 , count ($ vals ));
5461
5562 $ vals = array ();
5663 foreach ($ result ->getRows () as $ row ) {
5764 $ vals [] = $ row ->getValue ('foo ' );
5865 }
5966 $ this ->assertContains ('bar ' , $ vals );
60- $ this ->assertEquals (10 , count ($ vals ));
67+ $ this ->assertEquals (9 , count ($ vals ));
6168 }
6269
6370 public function testQueryFieldSelector ()
6471 {
6572 /** @var $query QueryInterface */
66- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
67- 'SELECT data.foo FROM [nt:unstructured] AS data WHERE data.foo = "bar" ' ,
73+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
74+ SELECT data.foo
75+ FROM [nt:unstructured] AS data
76+ WHERE data.foo = "bar"
77+ AND ISDESCENDANTNODE([/tests_general_base])
78+ ' ,
6879 QueryInterface::JCR_SQL2
6980 );
7081
@@ -81,13 +92,14 @@ public function testQueryFieldSelector()
8192 public function testQueryJoin ()
8293 {
8394 /** @var $query QueryInterface */
84- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
85- 'SELECT content.longNumber
86- FROM [nt:file] AS file
87- INNER JOIN [nt:unstructured] AS content
88- ON ISDESCENDANTNODE(content, file)
89-
90- WHERE content.longNumber = 999 ' ,
95+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
96+ SELECT content.longNumber
97+ FROM [nt:file] AS file
98+ INNER JOIN [nt:unstructured] AS content
99+ ON ISDESCENDANTNODE(content, file)
100+ WHERE content.longNumber = 999
101+ AND ISDESCENDANTNODE(file, [/tests_general_base])
102+ ' ,
91103 QueryInterface::JCR_SQL2
92104 );
93105
@@ -128,10 +140,12 @@ public function testQueryJoinReference()
128140 public function testQueryOrder ()
129141 {
130142 /** @var $query QueryInterface */
131- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
132- 'SELECT data.zeronumber
133- FROM [nt:unstructured] AS data
134- ORDER BY data.zeronumber ' ,
143+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
144+ SELECT data.zeronumber
145+ FROM [nt:unstructured] AS data
146+ WHERE ISDESCENDANTNODE([/tests_general_base])
147+ ORDER BY data.zeronumber
148+ ' ,
135149 QueryInterface::JCR_SQL2
136150 );
137151
@@ -143,17 +157,18 @@ public function testQueryOrder()
143157 $ vals [] = $ row ->getValue ('data.zeronumber ' );
144158 }
145159 // rows that do not have that field are null. empty is before fields with values
146- $ this ->assertEquals (array (null , null , null , null , null , null , null , null , null , 0 ), $ vals );
160+ $ this ->assertEquals (array (null , null , null , null , null , null , null , null , 0 ), $ vals );
147161 }
148162
149163 public function testQueryMultiValuedProperty ()
150164 {
151165 /** @var $query QueryInterface */
152- $ query = $ this ->sharedFixture ['qm ' ]->createQuery (
153- ' SELECT data.tags
166+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
167+ SELECT data.tags
154168 FROM [nt:unstructured] AS data
155169 WHERE data.tags = "foo"
156- AND data.tags = "bar"
170+ AND data.tags = "bar"
171+ AND ISDESCENDANTNODE([/tests_general_base])
157172 ' ,
158173 QueryInterface::JCR_SQL2
159174 );
0 commit comments