mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
The scanner that finds placeholders in queries excluded e/E from plain
text, because they can start an E'...' string. So every e/E in a query
(SELECT, WHERE, created_at, ...) ended a text token and became a
one-character token of its own. Allow e/E inside text as long as the
text doesn't end with one, so E'...' strings are still recognized.
Also let re2c generate bitmaps (-b) for the character classes instead
of a switch on every input character.
The scanner runs in PDO::prepare() and, with emulated prepares, again in
PDOStatement::execute(). Instructions for 200k calls of prepare():
emulated native
SELECT, 11 cols -24% -16%
INSERT, 8 params -15% -7%
For a whole emulated query (prepare, execute, fetch one row) against a
local server, PHP executes 7-9% fewer instructions.
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Close GH-24353
8 lines
310 B
GLSL
8 lines
310 B
GLSL
$(srcdir)/pgsql_sql_parser.c: $(srcdir)/pgsql_sql_parser.re
|
|
@(cd $(top_srcdir); \
|
|
if test -f ./pgsql_sql_parser.re; then \
|
|
$(RE2C) $(RE2C_FLAGS) -b -o pgsql_sql_parser.c pgsql_sql_parser.re; \
|
|
else \
|
|
$(RE2C) $(RE2C_FLAGS) -b -o ext/pdo_pgsql/pgsql_sql_parser.c ext/pdo_pgsql/pgsql_sql_parser.re; \
|
|
fi)
|