mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Support hex-string input and output for type BYTEA.
Both hex format and the traditional "escape" format are automatically handled on input. The output format is selected by the new GUC variable bytea_output. As committed, bytea_output defaults to HEX, which is an *incompatible change*. We will keep it this way for awhile for testing purposes, but should consider whether to switch to the more backwards-compatible default of ESCAPE before 8.5 is released. Peter Eisentraut
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.23 2009/01/01 17:23:49 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.24 2009/08/04 16:08:36 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -109,7 +109,7 @@ binary_decode(PG_FUNCTION_ARGS)
|
||||
* HEX
|
||||
*/
|
||||
|
||||
static const char *hextbl = "0123456789abcdef";
|
||||
static const char hextbl[] = "0123456789abcdef";
|
||||
|
||||
static const int8 hexlookup[128] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
@ -122,7 +122,7 @@ static const int8 hexlookup[128] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static unsigned
|
||||
unsigned
|
||||
hex_encode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
const char *end = src + len;
|
||||
@ -136,7 +136,7 @@ hex_encode(const char *src, unsigned len, char *dst)
|
||||
return len * 2;
|
||||
}
|
||||
|
||||
static char
|
||||
static inline char
|
||||
get_hex(char c)
|
||||
{
|
||||
int res = -1;
|
||||
@ -152,7 +152,7 @@ get_hex(char c)
|
||||
return (char) res;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
unsigned
|
||||
hex_decode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
const char *s,
|
||||
|
Reference in New Issue
Block a user