Skip to content

Commit f993dd1

Browse files
author
Willem-Jan Zijderveld
committed
Some more complicated comparisons, shows bug/missing feature in SQL2 parser
1 parent 77122a3 commit f993dd1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

fixtures/06_Query/characters.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</sv:property>
5757

5858
<sv:property sv:name="quoteandbackslash" sv:type="String">
59-
<sv:value>"\'</sv:value>
59+
<sv:value>'a\'\'b\'\'c'</sv:value>
6060
</sv:property>
6161
</sv:node>
6262
</sv:node>

tests/06_Query/CharacterTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public function testPropertyWithQuotes()
6464
{
6565
/** @var QueryManager $queryManager */
6666
$queryManager = $this->sharedFixture['qm'];
67-
$query = $queryManager->createQuery('
67+
$query = $queryManager->createQuery(sprintf('
6868
SELECT data.quotes
6969
FROM [nt:unstructured] AS data
70-
WHERE data.quotes = "\"\'"
71-
',
70+
WHERE data.quotes = "%s"
71+
', "\\\"'"),
7272
QueryInterface::JCR_SQL2
7373
);
7474

@@ -86,18 +86,18 @@ public function testPropertyWithQuotesAndBackslash()
8686
{
8787
/** @var QueryManager $queryManager */
8888
$queryManager = $this->sharedFixture['qm'];
89-
$query = $queryManager->createQuery('
89+
$query = $queryManager->createQuery(sprintf('
9090
SELECT data.quoteandbackslash
9191
FROM [nt:unstructured] AS data
92-
WHERE data.quotes = "\\"\\\'"
93-
',
92+
WHERE data.quoteandbackslash = "%s"
93+
', "'a\'\'b\'\'c'"),
9494
QueryInterface::JCR_SQL2
9595
);
9696

9797
$result = $query->execute();
9898

9999
$rows = $result->getRows();
100100
$this->assertCount(1, $rows);
101-
$this->assertEquals('"\\\'', $rows->current()->getValue('quoteandbackslash'));
101+
$this->assertEquals("'a\'\'b\'\'c'", $rows->current()->getValue('quoteandbackslash'));
102102
}
103103
}

0 commit comments

Comments
 (0)