Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita794b99

Browse files
committed
Fix example of de-escaping bytea argument, per Florian Weimer. Also fix example
of escaping bytea return value. Both cases did not handle backslash values properly.
1 parent353a1cc commita794b99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎doc/src/sgml/plperl.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.66 2007/05/04 14:55:32 adunstan Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.67 2008/01/25 15:28:35 adunstan Exp $ -->
22

33
<chapter id="plperl">
44
<title>PL/Perl - Perl Procedural Language</title>
@@ -150,7 +150,7 @@ $$ LANGUAGE plperl;
150150

151151
<programlisting>
152152
my $arg = shift;
153-
$arg =~ s!\\(\d{3})!chr(oct($1))!ge;
153+
$arg =~ s!\\(?:\\|(\d{3}))!$1 ?chr(oct($1)) : "\\"!ge;
154154
</programlisting>
155155

156156
</para>
@@ -161,7 +161,7 @@ $$ LANGUAGE plperl;
161161
is how to escape binary data for a return value of type <type>bytea</>:
162162

163163
<programlisting>
164-
$retval =~ s!([^ -~])!sprintf("\\%03o",ord($1))!ge;
164+
$retval =~ s!(\\|[^ -~])!sprintf("\\%03o",ord($1))!ge;
165165
return $retval;
166166
</programlisting>
167167

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp