Commit 317ff59c authored by Bruce Momjian's avatar Bruce Momjian

to_ascii( text )

        - encode 'text' from database encoding to ASCII

        to_ascii('\256\341k')


 to_ascii( text, int4 )

        - encode 'text' from 'int4' encoding to ASCII

          to_ascii('\256\341k', 8)


 to_ascii( text, name )

        - encode 'text' from 'name' encoding to ASCII

          to_ascii('\256\341k', 'LATIN2')


  Now is supported LATIN1, LATIN2, WIN1250. For other character sets I
haven't good resources. Add new encoding is easy...

 If encoding is not supported returns ERROR.

 Note --- not exists total corect conversion to ASCII, this function try
        convert chars those is _probably_ interpret-able in ASCII for
        others use ' '. But for example for all Czech characters it is
        sufficient ... hmm Chinese / JAP and other complicated langs
have
        bad luck here :-(

                                                Karel
parent a1464e97
# #
# Makefile for utils/adt # Makefile for utils/adt
# #
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.41 2000/07/30 22:13:52 tgl Exp $ # $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.42 2000/08/04 15:45:07 momjian Exp $
# #
subdir = src/backend/utils/adt subdir = src/backend/utils/adt
...@@ -23,7 +23,8 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \ ...@@ -23,7 +23,8 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \ regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
tid.o timestamp.o varbit.o varchar.o varlena.o version.o \ tid.o timestamp.o varbit.o varchar.o varlena.o version.o \
network.o mac.o inet_net_ntop.o inet_net_pton.o \ network.o mac.o inet_net_ntop.o inet_net_pton.o \
ri_triggers.o pg_lzcompress.o pg_locale.o formatting.o ri_triggers.o pg_lzcompress.o pg_locale.o formatting.o \
ascii.o
all: SUBSYS.o all: SUBSYS.o
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_proc.h,v 1.157 2000/08/03 23:07:46 tgl Exp $ * $Id: pg_proc.h,v 1.158 2000/08/04 15:45:12 momjian Exp $
* *
* NOTES * NOTES
* The script catalog/genbki.sh reads this file and generates .bki * The script catalog/genbki.sh reads this file and generates .bki
...@@ -2442,6 +2442,14 @@ DESCR("aggregate transition function"); ...@@ -2442,6 +2442,14 @@ DESCR("aggregate transition function");
DATA(insert OID = 1844 ( interval_avg PGUID 12 f t t t 1 f 1186 "1187" 100 0 0 100 interval_avg - )); DATA(insert OID = 1844 ( interval_avg PGUID 12 f t t t 1 f 1186 "1187" 100 0 0 100 interval_avg - ));
DESCR("AVG aggregate final function"); DESCR("AVG aggregate final function");
/* To ASCII conversion */
DATA(insert OID = 1845 ( to_ascii PGUID 12 f t t t 1 f 25 "25" 100 0 0 100 to_ascii_default - ));
DESCR("encode text from DB encoding to ASCII text");
DATA(insert OID = 1846 ( to_ascii PGUID 12 f t t t 2 f 25 "25 23" 100 0 0 100 to_ascii_enc - ));
DESCR("encode text from encoding to ASCII text");
DATA(insert OID = 1847 ( to_ascii PGUID 12 f t t t 2 f 25 "25 19" 100 0 0 100 to_ascii_encname - ));
DESCR("encode text from encoding to ASCII text");
DATA(insert OID = 1850 ( int28eq PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100 int28eq - )); DATA(insert OID = 1850 ( int28eq PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100 int28eq - ));
DESCR("equal"); DESCR("equal");
DATA(insert OID = 1851 ( int28ne PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100 int28ne - )); DATA(insert OID = 1851 ( int28ne PGUID 12 f t t t 2 f 16 "21 20" 100 0 0 100 int28ne - ));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment