mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Add support for \x hex strings in psql variables.
This commit is contained in:
parent
65537ac1b4
commit
b51366396b
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.137 2005/05/30 15:24:23 momjian Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.138 2005/06/02 01:23:48 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -589,8 +589,9 @@ testdb=>
|
|||||||
single quote. To include a single quote into such an argument,
|
single quote. To include a single quote into such an argument,
|
||||||
precede it by a backslash. Anything contained in single quotes is
|
precede it by a backslash. Anything contained in single quotes is
|
||||||
furthermore subject to C-like substitutions for
|
furthermore subject to C-like substitutions for
|
||||||
<literal>\n</literal> (new line), <literal>\t</literal> (tab), and
|
<literal>\n</literal> (new line), <literal>\t</literal> (tab),
|
||||||
<literal>\</literal><replaceable>digits</replaceable> (octal).
|
<literal>\</literal><replaceable>digits</replaceable> (octal),
|
||||||
|
<literal>\x</literal><replaceable>digits</replaceable> (hexadecimal).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.12 2005/05/30 16:48:47 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.13 2005/06/02 01:23:48 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -250,8 +250,9 @@ xnstart [nN]{quote}
|
|||||||
xqstart {quote}
|
xqstart {quote}
|
||||||
xqdouble {quote}{quote}
|
xqdouble {quote}{quote}
|
||||||
xqinside [^\\']+
|
xqinside [^\\']+
|
||||||
xqescape [\\][^0-7]
|
xqescape [\\][^0-7x]
|
||||||
xqoctesc [\\][0-7]{1,3}
|
xqoctesc [\\][0-7]{1,3}
|
||||||
|
xqhexesc [\\]x[0-9A-Fa-f]{1,2}
|
||||||
|
|
||||||
/* $foo$ style quotes ("dollar quoting")
|
/* $foo$ style quotes ("dollar quoting")
|
||||||
* The quoted string starts with $foo$ where "foo" is an optional string
|
* The quoted string starts with $foo$ where "foo" is an optional string
|
||||||
@ -467,6 +468,9 @@ other .
|
|||||||
<xq>{xqoctesc} {
|
<xq>{xqoctesc} {
|
||||||
ECHO;
|
ECHO;
|
||||||
}
|
}
|
||||||
|
<xq>{xqhexesc} {
|
||||||
|
ECHO;
|
||||||
|
}
|
||||||
<xq>{quotecontinue} {
|
<xq>{quotecontinue} {
|
||||||
ECHO;
|
ECHO;
|
||||||
}
|
}
|
||||||
@ -855,6 +859,12 @@ other .
|
|||||||
(char) strtol(yytext + 1, NULL, 8));
|
(char) strtol(yytext + 1, NULL, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{xqhexesc} {
|
||||||
|
/* hex case */
|
||||||
|
appendPQExpBufferChar(output_buf,
|
||||||
|
(char) strtol(yytext + 2, NULL, 16));
|
||||||
|
}
|
||||||
|
|
||||||
"\\". { emit(yytext + 1, 1); }
|
"\\". { emit(yytext + 1, 1); }
|
||||||
|
|
||||||
{other}|\n { ECHO; }
|
{other}|\n { ECHO; }
|
||||||
|
Loading…
Reference in New Issue
Block a user