File tree 4 files changed +40
-5
lines changed
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 $ -->
2
2
3
3
<chapter id="functions">
4
4
<title>Functions and Operators</title>
1051
1051
<entry>translate('12345', '14', 'ax')</entry>
1052
1052
<entry>a23x5</entry>
1053
1053
</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>
1054
1082
1055
1083
</tbody>
1056
1084
</tgroup>
Original file line number Diff line number Diff line change 1
1
#
2
2
# Makefile for utils/adt
3
3
#
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 $
5
5
#
6
6
7
7
subdir = src/backend/utils/adt
@@ -24,7 +24,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \
24
24
tid.o timestamp.o varbit.o varchar.o varlena.o version.o \
25
25
network.o mac.o inet_net_ntop.o inet_net_pton.o \
26
26
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
28
28
29
29
all : SUBSYS.o
30
30
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
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 $
11
11
*
12
12
* NOTES
13
13
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2684,6 +2684,11 @@ DESCR("Statistics: Blocks fetched for database");
2684
2684
DATA (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 - ));
2685
2685
DESCR ("Statistics: Block found in cache for database" );
2686
2686
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
+
2687
2692
/*
2688
2693
* prototypes for functions pg_proc.c
2689
2694
*/
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -409,6 +409,8 @@ extern Datum byteaGetByte(PG_FUNCTION_ARGS);
409
409
extern Datum byteaGetBit (PG_FUNCTION_ARGS );
410
410
extern Datum byteaSetByte (PG_FUNCTION_ARGS );
411
411
extern Datum byteaSetBit (PG_FUNCTION_ARGS );
412
+ extern Datum binary_encode (PG_FUNCTION_ARGS );
413
+ extern Datum binary_decode (PG_FUNCTION_ARGS );
412
414
413
415
/* version.c */
414
416
extern Datum pgsql_version (PG_FUNCTION_ARGS );
You can’t perform that action at this time.
0 commit comments