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

Commit7771436

Browse files
committed
> > Put encode() into base system. Used part of Alex' patch
> > for docs, hope he does not mind ;)Marko Kreen
1 parent4051bce commit7771436

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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>
@@ -1051,6 +1051,34 @@
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>

‎src/backend/utils/adt/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

77
subdir = 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

2929
all: SUBSYS.o
3030

‎src/include/catalog/pg_proc.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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");
26842684
DATA(insertOID=1945 (pg_stat_get_db_blocks_hitPGUID12fttt1f20"26"10000100pg_stat_get_db_blocks_hit- ));
26852685
DESCR("Statistics: Block found in cache for database");
26862686

2687+
DATA(insertOID=1946 (encodePGUID12fttt2f25"17 25"10000100binary_encode- ));
2688+
DESCR("Convert bytea value into some ascii-only text string");
2689+
DATA(insertOID=1947 (decodePGUID12fttt2f17"25 25"10000100binary_decode- ));
2690+
DESCR("Convert ascii-encoded text string into bytea value");
2691+
26872692
/*
26882693
* prototypes for functions pg_proc.c
26892694
*/

‎src/include/utils/builtins.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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);
409409
externDatumbyteaGetBit(PG_FUNCTION_ARGS);
410410
externDatumbyteaSetByte(PG_FUNCTION_ARGS);
411411
externDatumbyteaSetBit(PG_FUNCTION_ARGS);
412+
externDatumbinary_encode(PG_FUNCTION_ARGS);
413+
externDatumbinary_decode(PG_FUNCTION_ARGS);
412414

413415
/* version.c */
414416
externDatumpgsql_version(PG_FUNCTION_ARGS);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp