diff options
| author | Bruce Momjian <bruce@momjian.us> | 2000-06-15 18:55:34 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2000-06-15 18:55:34 +0000 |
| commit | f7f177d372750e4f766ccefdf20e1b30d66cba0a (patch) | |
| tree | d4e2a148640ba36d9a1e8cbf8557faa606ce5ba1 /contrib/soundex | |
| parent | 82c4733116813ff862dade1984b6fb74149f4124 (diff) | |
| download | postgresql-f7f177d372750e4f766ccefdf20e1b30d66cba0a.tar.gz | |
/contrib patch from Karel.
Diffstat (limited to 'contrib/soundex')
| -rw-r--r-- | contrib/soundex/Makefile | 55 | ||||
| -rw-r--r-- | contrib/soundex/README | 53 | ||||
| -rw-r--r-- | contrib/soundex/soundex.sql.in | 55 |
3 files changed, 86 insertions, 77 deletions
diff --git a/contrib/soundex/Makefile b/contrib/soundex/Makefile index 059fd6d4ee..57157b8e98 100644 --- a/contrib/soundex/Makefile +++ b/contrib/soundex/Makefile @@ -1,44 +1,53 @@ -#------------------------------------------------------------------------- # -# Makefile-- -# Makefile for soundex +# $Header: /cvsroot/pgsql/contrib/soundex/Attic/Makefile,v 1.3 2000/06/15 18:55:15 momjian Exp $ # -#------------------------------------------------------------------------- -PGDIR = ../.. -SRCDIR = $(PGDIR)/src +TOPDIR=../.. -include $(SRCDIR)/Makefile.global +include ../Makefile.global -CFLAGS += -I. $(CFLAGS_SL) - -MODNAME = soundex +NAME = soundex -MODULE = $(MODNAME)$(DLSUFFIX) +PROGRAM = +OBJS = $(NAME).o +DOCS = $(NAME).doc +SQLS = $(NAME).sql +BINS = +EXAMPLES= +MODS = $(NAME)$(DLSUFFIX) -all: module sql +CFLAGS += -I. $(CFLAGS_SL) -module: $(MODULE) +OTHER_CLEAN = $(SQLS) -sql: $(MODNAME).sql +all: $(MODS) $(SQLS) -install: $(MODULE) - cp -p $(MODULE) $(LIBDIR)/modules - cd $(LIBDIR)/modules; strip $(MODULE) %.sql: %.sql.in - sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@ + $(SED) "s|MODULE_PATHNAME|$(CONTRIB_MODDIR)/$@|" < $< > $@ + +install: install_doc install_sql install_mod + +install_doc: + for inst_file in $(DOCS); do \ + $(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_DOCDIR); \ + done -.SUFFIXES: $(DLSUFFIX) +install_sql: + for inst_file in $(SQLS); do \ + $(INSTALL) $(INSTL_LIB_OPTS) $$inst_file $(CONTRIB_SQLDIR); \ + done -%$(DLSUFFIX): %.c - $(CC) $(CFLAGS) -shared -o $@ $< +install_mod: + for inst_file in $(MODS); do \ + $(INSTALL) $(INSTL_SHLIB_OPTS) $$inst_file $(CONTRIB_MODDIR); \ + done depend dep: - $(CC) -MM $(CFLAGS) *.c >depend + $(CC) -MM -MG $(CFLAGS) *.c > depend clean: - rm -f $(MODULE) $(MODNAME).sql + $(RM) *~ $(OBJS) $(MODS) $(PROGRAM) depend $(OTHER_CLEAN) core log ifeq (depend,$(wildcard depend)) include depend diff --git a/contrib/soundex/README b/contrib/soundex/README new file mode 100644 index 0000000000..e3ba4ee231 --- /dev/null +++ b/contrib/soundex/README @@ -0,0 +1,53 @@ + +SELECT text_soundex('hello world!'); + +CREATE TABLE s (nm text)\g + +insert into s values ('john')\g +insert into s values ('joan')\g +insert into s values ('wobbly')\g + +select * from s +where text_soundex(nm) = text_soundex('john')\g + +select nm from s a, s b +where text_soundex(a.nm) = text_soundex(b.nm) +and a.oid <> b.oid\g + +CREATE FUNCTION text_sx_eq(text, text) RETURNS bool AS +'select text_soundex($1) = text_soundex($2)' +LANGUAGE 'sql'\g + +CREATE FUNCTION text_sx_lt(text,text) RETURNS bool AS +'select text_soundex($1) < text_soundex($2)' +LANGUAGE 'sql'\g + +CREATE FUNCTION text_sx_gt(text,text) RETURNS bool AS +'select text_soundex($1) > text_soundex($2)' +LANGUAGE 'sql'; + +CREATE FUNCTION text_sx_le(text,text) RETURNS bool AS +'select text_soundex($1) <= text_soundex($2)' +LANGUAGE 'sql'; + +CREATE FUNCTION text_sx_ge(text,text) RETURNS bool AS +'select text_soundex($1) >= text_soundex($2)' +LANGUAGE 'sql'; + +CREATE FUNCTION text_sx_ne(text,text) RETURNS bool AS +'select text_soundex($1) <> text_soundex($2)' +LANGUAGE 'sql'; + +DROP OPERATOR #= (text,text)\g + +CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq, +commutator=text_sx_eq)\g + +SELECT * +FROM s +WHERE text_sx_eq(nm,'john')\g + +SELECT * +from s +where s.nm #= 'john'; + diff --git a/contrib/soundex/soundex.sql.in b/contrib/soundex/soundex.sql.in index 89b9fa5222..d8e66cd02a 100644 --- a/contrib/soundex/soundex.sql.in +++ b/contrib/soundex/soundex.sql.in @@ -1,57 +1,4 @@ ---------------- soundex.sql: CREATE FUNCTION text_soundex(text) RETURNS text - AS '_OBJWD_/soundex.so' LANGUAGE 'c'; - -SELECT text_soundex('hello world!'); - -CREATE TABLE s (nm text)\g - -insert into s values ('john')\g -insert into s values ('joan')\g -insert into s values ('wobbly')\g - -select * from s -where text_soundex(nm) = text_soundex('john')\g - -select nm from s a, s b -where text_soundex(a.nm) = text_soundex(b.nm) -and a.oid <> b.oid\g - -CREATE FUNCTION text_sx_eq(text, text) RETURNS bool AS -'select text_soundex($1) = text_soundex($2)' -LANGUAGE 'sql'\g - -CREATE FUNCTION text_sx_lt(text,text) RETURNS bool AS -'select text_soundex($1) < text_soundex($2)' -LANGUAGE 'sql'\g - -CREATE FUNCTION text_sx_gt(text,text) RETURNS bool AS -'select text_soundex($1) > text_soundex($2)' -LANGUAGE 'sql'; - -CREATE FUNCTION text_sx_le(text,text) RETURNS bool AS -'select text_soundex($1) <= text_soundex($2)' -LANGUAGE 'sql'; - -CREATE FUNCTION text_sx_ge(text,text) RETURNS bool AS -'select text_soundex($1) >= text_soundex($2)' -LANGUAGE 'sql'; - -CREATE FUNCTION text_sx_ne(text,text) RETURNS bool AS -'select text_soundex($1) <> text_soundex($2)' -LANGUAGE 'sql'; - -DROP OPERATOR #= (text,text)\g - -CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq, -commutator=text_sx_eq)\g - -SELECT * -FROM s -WHERE text_sx_eq(nm,'john')\g - -SELECT * -from s -where s.nm #= 'john'; + AS 'MODULE_PATHNAME' LANGUAGE 'c'; |
