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)
3030 QUESTION = [?];
3131 ESCQUESTION = [?][?];
3232 COMMENTS = ("/*"([^*]+|[*]+[^/*])*[*]*"*/ " |" --" [^\r\n ]*);
33- SPECIALS = [:?" ' /-];
33+ SPECIALS = [eE :?" ' /-];
3434 MULTICHAR = [:]{2,};
3535 ANYNOEOF = [\001 -\377 ];
3636 */
3737
3838 /*!re2c
39+ [eE]([' ](([' ][' ])|([\\]ANYNOEOF)|ANYNOEOF\[' \\ ])*[' ]) { RET (PDO_PARSER_TEXT); }
3940 ([" ](([" ][" ])|ANYNOEOF\[" ])*[" ]) { RET(PDO_PARSER_TEXT); }
4041 (['](([']['])|ANYNOEOF\['])*[']) { RET(PDO_PARSER_TEXT); }
4142 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