PQescapeBytea documentation patch

Поиск
Список
Период
Сортировка
Искать

PQescapeBytea documentation patch

От:
Joe Conway <joseph.conway@home.com>
Дата:
*** sgml.orig/libpq.sgml Sun Nov 18 19:58:23 2001 --- sgml/libpq.sgml Tue Nov 20 12:16:30 2001 *************** *** 903,908 **** --- 903,958 ---- + + + + + escaping binary strings + + + PQescapeBytea + Escapes a binary string (bytea type) for use within an SQL query. + + unsigned char *PQescapeBytea(unsigned char *from, + size_t from_length, + size_t *to_length); + + + Certain ASCII characters MUST be escaped (but all + characters MAY be escaped) when used as part of a BYTEA + string literal in an SQL statement. In general, to + escape a character, it is converted into the three digit octal number + equal to the decimal ASCII value, and preceeded by + two backslashes. The single quote (') and backslash (\) characters have + special alternate escape sequences. See the Binary String data type + in the User's Guide for more information. PQescapeBytea + performs this operation, escaping only the minimally + required characters. + + + + The from parameter points to the first + character of the string that is to be escaped, and the + from_length parameter reflects the number of + characters in this binary string (a terminating NUL character is + neither necessary nor counted). The to_length + parameter shall point to a buffer suitable to hold the resultant + escaped string length. The result string length does not + include the terminating NUL character of the result. + + + + PQescapeBytea returns an escaped version of the + from parameter binary string, to a caller + provided buffer. The return string has all special characters replaced + so that they can be properly processed by the PostgreSQL string literal + parser, and the bytea input function. A terminating NUL + character is also added. The single quotes that must surround + PostgreSQL string literals are not part of the result string. + + + +

Re: PQescapeBytea documentation patch

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

We can fix any cross-reference later.  I am applying any reasonable doc
changes and /contrib change by authors right away because we don't have
time for delay.

Patch applied.  Thanks.

---------------------------------------------------------------------------


> Here's a patch adding documentation for the PQescapeBytea function to 
> libpq.sgml
> 
> I was trying (but gave up) to cross-reference back to the input escape 
> table in the User's Guide, but could not get the documentation to 
> compile with a cross-book xref (missing IDREF error). Can a cross-book 
> xref be done?
> 
> Thanks,
> 
> Joe

[ text/html is unsupported, treating like TEXT/PLAIN ]

> *** sgml.orig/libpq.sgml	Sun Nov 18 19:58:23 2001
> --- sgml/libpq.sgml	Tue Nov 20 12:16:30 2001
> ***************
> *** 903,908 ****
> --- 903,958 ----
>   
>   
>   
> + 
> +  
> +   Escaping binary strings for inclusion in SQL queries
> +   
> +    escaping binary strings
> +   
> +   
> +    PQescapeBytea
> +    Escapes a binary string (bytea type) for use within an SQL query.
> +    
> +     unsigned char *PQescapeBytea(unsigned char *from,
> +                                          size_t from_length,
> +                                          size_t *to_length);
> +    
> + 
> +    Certain ASCII characters MUST be escaped (but all
> +    characters MAY be escaped) when used as part of a BYTEA
> +    string literal in an SQL statement. In general, to
> +    escape a character, it is converted into the three digit octal number
> +    equal to the decimal ASCII value, and preceeded by
> +    two backslashes. The single quote (') and backslash (\) characters have
> +    special alternate escape sequences. See the Binary String data type
> +    in the User's Guide for more information. PQescapeBytea
> +     performs this operation, escaping only the minimally
> +    required characters.
> +   
> + 
> +   
> +    The from parameter points to the first
> +    character of the string that is to be escaped, and the
> +    from_length parameter reflects the number of
> +    characters in this binary string (a terminating NUL character is
> +    neither necessary nor counted).  The to_length
> +    parameter shall point to a buffer suitable to hold the resultant
> +    escaped string length. The result string length does not
> +    include the terminating NUL character of the result.
> +   
> + 
> +   
> +    PQescapeBytea</> returns an escaped version of the
> +    from parameter binary string, to a caller
> +    provided buffer. The return string has all special characters replaced
> +    so that they can be properly processed by the PostgreSQL string literal
> +    parser, and the bytea input function. A terminating NUL
> +    character is also added.  The single quotes that must surround
> +    PostgreSQL string literals are not part of the result string.
> +   
> +  
> + 
> + 
>   
>     Retrieving SELECT Result Information
>   

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
FAQ