File tree Expand file tree Collapse file tree 4 files changed +40
-5
lines changed Expand file tree Collapse file tree 4 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 1- <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.63 2001/07/03 02:42:18 momjian Exp $ -->
1+ <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.64 2001/07/11 22:14:01 momjian Exp $ -->
22
33<chapter id="functions">
44 <title>Functions and Operators</title>
10511051 <entry>translate('12345', '14', 'ax')</entry>
10521052 <entry>a23x5</entry>
10531053 </row>
1054+
1055+ <row>
1056+ <entry>
1057+ encode(<parameter>data</parameter> <type>bytea</type>,
1058+ <parameter>type</parameter> <type>text</type>)
1059+ </entry>
1060+ <entry><type>text</type></entry>
1061+ <entry>
1062+ Encodes binary data to ascii-only representation. Supported
1063+ types are: 'base64', 'hex'.
1064+ </entry>
1065+ <entry>encode('123\\000\\001', 'base64')</entry>
1066+ <entry>MTIzAAE=</entry>
1067+ </row>
1068+
1069+ <row>
1070+ <entry>
1071+ decode(<parameter>string</parameter> <type>text</type>,
1072+ <parameter>type</parameter> <type>text</type>)
1073+ </entry>
1074+ <entry><type>bytea</type></entry>
1075+ <entry>
1076+ Decodes binary data from <parameter>string</parameter> previously
1077+ encoded with encode(). Parameter type is same as in encode().
1078+ </entry>
1079+ <entry>decode('MTIzAAE=', 'base64')</entry>
1080+ <entry>123\000\001</entry>
1081+ </row>
10541082
10551083 </tbody>
10561084 </tgroup>
Original file line number Diff line number Diff line change 11#
22# Makefile for utils/adt
33#
4- # $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.49 2001/06/22 19:16:23 wieck Exp $
4+ # $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.50 2001/07/11 22:14:02 momjian Exp $
55#
66
77subdir = src/backend/utils/adt
@@ -24,7 +24,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \
2424 tid.o timestamp.o varbit.o varchar.o varlena.o version.o \
2525 network.o mac.o inet_net_ntop.o inet_net_pton.o \
2626 ri_triggers.o pg_lzcompress.o pg_locale.o formatting.o \
27- ascii.o quote.o pgstatfuncs.o
27+ ascii.o quote.o pgstatfuncs.o encode.o
2828
2929all : SUBSYS.o
3030
Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $Id: pg_proc.h,v 1.195 2001/06/22 19:16:24 wieck Exp $
10+ * $Id: pg_proc.h,v 1.196 2001/07/11 22:14:02 momjian Exp $
1111 *
1212 * NOTES
1313 * The script catalog/genbki.sh reads this file and generates .bki
@@ -2684,6 +2684,11 @@ DESCR("Statistics: Blocks fetched for database");
26842684DATA (insert OID = 1945 ( pg_stat_get_db_blocks_hit PGUID 12 f t t t 1 f 20 "26" 100 0 0 100 pg_stat_get_db_blocks_hit - ));
26852685DESCR ("Statistics: Block found in cache for database" );
26862686
2687+ DATA (insert OID = 1946 ( encode PGUID 12 f t t t 2 f 25 "17 25" 100 0 0 100 binary_encode - ));
2688+ DESCR ("Convert bytea value into some ascii-only text string" );
2689+ DATA (insert OID = 1947 ( decode PGUID 12 f t t t 2 f 17 "25 25" 100 0 0 100 binary_decode - ));
2690+ DESCR ("Convert ascii-encoded text string into bytea value" );
2691+
26872692/*
26882693 * prototypes for functions pg_proc.c
26892694 */
Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $Id: builtins.h,v 1.156 2001/06/25 21:11:45 tgl Exp $
10+ * $Id: builtins.h,v 1.157 2001/07/11 22:14:03 momjian Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -409,6 +409,8 @@ extern Datum byteaGetByte(PG_FUNCTION_ARGS);
409409extern Datum byteaGetBit (PG_FUNCTION_ARGS );
410410extern Datum byteaSetByte (PG_FUNCTION_ARGS );
411411extern Datum byteaSetBit (PG_FUNCTION_ARGS );
412+ extern Datum binary_encode (PG_FUNCTION_ARGS );
413+ extern Datum binary_decode (PG_FUNCTION_ARGS );
412414
413415/* version.c */
414416extern Datum pgsql_version (PG_FUNCTION_ARGS );
You can’t perform that action at this time.
0 commit comments