Committed by David Christensen <[email protected]>
allow hi-bit chars in dollar-quoted identifiers
---
dbdimp.c | 6 +++---
t/12placeholders.t | 11 ++++++++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dbdimp.c b/dbdimp.c
index 0c1d22f..b6f1235 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -1785,12 +1785,12 @@ static void pg_st_split_statement (pTHX_ imp_sth_t * imp_sth, int version, char
(*statement == '$'
|| *statement == '_'
|| (*statement >= 'A' && *statement <= 'Z')
- || (*statement >= 'a' && *statement <= 'z'))) {
+ || (*statement >= 'a' && *statement <= 'z')
+ || ((unsigned char)*statement >= (unsigned char)'\200'))) {
/* "SQL identifiers must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters)
or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores,
digits (0-9), or dollar signs ($)
*/
- /* Postgres technically allows \200-\377 as well, but we don't */
sectionsize = 0; /* How far from the first dollar sign are we? */
found = 0; /* Have we found the end of the dollarquote? */
@@ -1808,7 +1808,7 @@ static void pg_st_split_statement (pTHX_ imp_sth_t * imp_sth, int version, char
|| (ch >= 58 && ch <= 64)
|| (ch >= 91 && ch <= 94)
|| ch == 96
- || (ch >= 123)) {
+ ) {
break;
}
} /* end first scan */
diff --git a/t/12placeholders.t b/t/12placeholders.t
index f897b22..921f0f9 100644
--- a/t/12placeholders.t
+++ b/t/12placeholders.t
@@ -17,7 +17,7 @@ my $dbh = connect_database();
if (! $dbh) {
plan skip_all => 'Connection to database failed, cannot continue testing';
}
-plan tests => 235;
+plan tests => 238;
my $t='Connect to database for placeholder testing';
isnt ($dbh, undef, $t);
@@ -553,6 +553,15 @@ for my $char (qw{0 9 A Z a z}) { ## six letters
is ($@, q{}, $t);
}
+for my $ident (qq{\x{5317}}, qq{abc\x{5317}}, qq{_cde\x{5317}}) { ## hi-bit chars
+ eval {
+ $sth = $dbh->prepare(qq{SELECT \$$ident\$ 123 \$$ident\$});
+ $sth->execute();
+ $sth->finish();
+ };
+ is ($@, q{}, $t);
+}
+
}
SKIP: {
--
1.7.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.