File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,13 @@ int pdo_pgsql_scanner(pdo_scanner_t *s)
30
30
QUESTION = [?];
31
31
ESCQUESTION = [?][?];
32
32
COMMENTS = ("/*"([^*]+|[*]+[^/*])*[*]*"*/ " |" --" [^\r\n ]*);
33
- SPECIALS = [:?" ' /-];
33
+ SPECIALS = [eE :?" ' /-];
34
34
MULTICHAR = [:]{2,};
35
35
ANYNOEOF = [\001 -\377 ];
36
36
*/
37
37
38
38
/*!re2c
39
+ [eE]([' ](([' ][' ])|([\\]ANYNOEOF)|ANYNOEOF\[' \\ ])*[' ]) { RET (PDO_PARSER_TEXT); }
39
40
([" ](([" ][" ])|ANYNOEOF\[" ])*[" ]) { RET(PDO_PARSER_TEXT); }
40
41
(['](([']['])|ANYNOEOF\['])*[']) { RET(PDO_PARSER_TEXT); }
41
42
MULTICHAR { RET(PDO_PARSER_TEXT); }
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ PgSQL PDO Parser custom syntax
3
+ --EXTENSIONS--
4
+ pdo
5
+ pdo_pgsql
6
+ --SKIPIF--
7
+ <?php
8
+ require __DIR__ . '/config.inc ' ;
9
+ require dirname (__DIR__ , 2 ) . '/pdo/tests/pdo_test.inc ' ;
10
+ PDOTest::skip ();
11
+ ?>
12
+ --FILE--
13
+ <?php
14
+
15
+ require_once __DIR__ . "/config.inc " ;
16
+
17
+ $ db = new PdoPgsql ($ config ['ENV ' ]['PDOTEST_DSN ' ]);
18
+ $ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
19
+
20
+ $ query = <<<EOF
21
+ SELECT e'He''ll\'o ' || ? AS b -- '
22
+ UNION ALL
23
+ SELECT 'He''ll''o\' || ? AS b -- '
24
+ EOF ;
25
+
26
+ $ stmt = $ db ->prepare ($ query );
27
+ $ stmt ->execute (['World ' , 'World ' ]);
28
+
29
+ while ($ row = $ stmt ->fetchColumn ()) {
30
+ var_dump ($ row );
31
+ }
32
+
33
+ ?>
34
+ --EXPECT--
35
+ string(13) "He'll'o World"
36
+ string(13) "He'll'o\World"
You can’t perform that action at this time.
0 commit comments