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

Commit0042933

Browse files
committed
Here's a patch adding documentation for the PQescapeBytea function to
libpq.sgmlI was trying (but gave up) to cross-reference back to the input escapetable in the User's Guide, but could not get the documentation tocompile with a cross-book xref (missing IDREF error). Can a cross-bookxref be done? Joe Conway
1 parent60f7776 commit0042933

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.77 2001/11/19 03:58:23 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.78 2001/11/20 20:28:31 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -903,6 +903,56 @@ strings overlap.
903903
</para>
904904
</sect2>
905905

906+
907+
<sect2 id="libpq-exec-escape-bytea">
908+
<title>Escaping binary strings for inclusion in SQL queries</title>
909+
<indexterm zone="libpq-exec-escape-bytea">
910+
<primary>escaping binary strings</primary>
911+
</indexterm>
912+
<para>
913+
<function>PQescapeBytea</function>
914+
Escapes a binary string (bytea type) for use within an SQL query.
915+
<synopsis>
916+
unsigned char *PQescapeBytea(unsigned char *from,
917+
size_t from_length,
918+
size_t *to_length);
919+
</synopsis>
920+
921+
Certain <acronym>ASCII</acronym> characters MUST be escaped (but all
922+
characters MAY be escaped) when used as part of a <type>BYTEA</type>
923+
string literal in an <acronym>SQL</acronym> statement. In general, to
924+
escape a character, it is converted into the three digit octal number
925+
equal to the decimal <acronym>ASCII</acronym> value, and preceeded by
926+
two backslashes. The single quote (') and backslash (\) characters have
927+
special alternate escape sequences. See the Binary String data type
928+
in the User's Guide for more information. <function>PQescapeBytea
929+
</function> performs this operation, escaping only the minimally
930+
required characters.
931+
</para>
932+
933+
<para>
934+
The <parameter>from</parameter> parameter points to the first
935+
character of the string that is to be escaped, and the
936+
<parameter>from_length</parameter> parameter reflects the number of
937+
characters in this binary string (a terminating NUL character is
938+
neither necessary nor counted). The <parameter>to_length</parameter>
939+
parameter shall point to a buffer suitable to hold the resultant
940+
escaped string length. The result string length does not
941+
include the terminating NUL character of the result.
942+
</para>
943+
944+
<para>
945+
<function>PQescapeBytea</> returns an escaped version of the
946+
<parameter>from</parameter> parameter binary string, to a caller
947+
provided buffer. The return string has all special characters replaced
948+
so that they can be properly processed by the PostgreSQL string literal
949+
parser, and the <type>bytea</type> input function. A terminating NUL
950+
character is also added. The single quotes that must surround
951+
PostgreSQL string literals are not part of the result string.
952+
</para>
953+
</sect2>
954+
955+
906956
<sect2 id="libpq-exec-select-info">
907957
<title>Retrieving SELECT Result Information</title>
908958

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp