1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-30 04:29:12 +01:00

Support identifiers with numbers and type casts

Named identifiers in prepared statement queries may now contain (but not begin with) numbers, i.e., :column3.

Type casts are now skipped (i.e., column_name::integer).
This commit is contained in:
Aaron Piotrowski 2018-02-04 23:06:32 -06:00
parent 33c056b635
commit 650d464ef8
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -5,7 +5,7 @@ namespace Amp\Postgres\Internal;
use function Amp\Postgres\cast;
const STATEMENT_PARAM_REGEX = <<<'REGEX'
~(["'`])(?:\\(?:\\|\1)|(?!\1).)*+\1(*SKIP)(*F)|(\$(\d+)|\?)|:([a-zA-Z_]+)~ms
~(["'`])(?:\\(?:\\|\1)|(?!\1).)*+\1(*SKIP)(*FAIL)|(\$(\d+)|\?)|(?<!:):([a-zA-Z_][a-zA-Z0-9_]*)~ms
REGEX;
/**