Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 04bd261

Browse files
committed
Missed a few files that were added with the lib/modules patch...
1 parent 5b4b3d5 commit 04bd261

File tree

4 files changed

+376
-0
lines changed

4 files changed

+376
-0
lines changed

contrib/ip_and_mac/ip.sql.in

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
--
2+
-- PostgreSQL code for IP addresses.
3+
--
4+
-- $Id: ip.sql.in,v 1.1 1998/04/22 04:20:30 scrappy Exp $
5+
--
6+
7+
load '_OBJWD_/ip_DLSUFFIX_';
8+
9+
--
10+
-- Input and output functions and the type itself:
11+
--
12+
13+
create function ipaddr_in(opaque)
14+
returns opaque
15+
as '_OBJWD_/ip_DLSUFFIX_'
16+
language 'c';
17+
18+
create function ipaddr_out(opaque)
19+
returns opaque
20+
as '_OBJWD_/ip_DLSUFFIX_'
21+
language 'c';
22+
23+
create type ipaddr (
24+
internallength = 6,
25+
externallength = variable,
26+
input = ipaddr_in,
27+
output = ipaddr_out
28+
);
29+
30+
--
31+
-- The various boolean tests:
32+
--
33+
34+
create function ipaddr_lt(ipaddr, ipaddr)
35+
returns bool
36+
as '_OBJWD_/ip_DLSUFFIX_'
37+
language 'c';
38+
39+
create function ipaddr_le(ipaddr, ipaddr)
40+
returns bool
41+
as '_OBJWD_/ip_DLSUFFIX_'
42+
language 'c';
43+
44+
create function ipaddr_eq(ipaddr, ipaddr)
45+
returns bool
46+
as '_OBJWD_/ip_DLSUFFIX_'
47+
language 'c';
48+
49+
create function ipaddr_ge(ipaddr, ipaddr)
50+
returns bool
51+
as '_OBJWD_/ip_DLSUFFIX_'
52+
language 'c';
53+
54+
create function ipaddr_gt(ipaddr, ipaddr)
55+
returns bool
56+
as '_OBJWD_/ip_DLSUFFIX_'
57+
language 'c';
58+
59+
create function ipaddr_ne(ipaddr, ipaddr)
60+
returns bool
61+
as '_OBJWD_/ip_DLSUFFIX_'
62+
language 'c';
63+
64+
create function ipaddr_in_net(ipaddr, ipaddr)
65+
returns bool
66+
as '_OBJWD_/ip_DLSUFFIX_'
67+
language 'c';
68+
69+
create function ipaddr_mask(ipaddr)
70+
returns ipaddr
71+
as '_OBJWD_/ip_DLSUFFIX_'
72+
language 'c';
73+
74+
create function ipaddr_bcast(ipaddr)
75+
returns ipaddr
76+
as '_OBJWD_/ip_DLSUFFIX_'
77+
language 'c';
78+
79+
--
80+
-- Now the operators. Note how some of the parameters to some
81+
-- of the 'create operator' commands are commented out. This
82+
-- is because they reference as yet undefined operators, and
83+
-- will be implicitly defined when those are, further down.
84+
--
85+
86+
create operator < (
87+
leftarg = ipaddr,
88+
rightarg = ipaddr,
89+
-- negator = >=,
90+
procedure = ipaddr_lt
91+
);
92+
93+
create operator <= (
94+
leftarg = ipaddr,
95+
rightarg = ipaddr,
96+
-- negator = >,
97+
procedure = ipaddr_le
98+
);
99+
100+
create operator = (
101+
leftarg = ipaddr,
102+
rightarg = ipaddr,
103+
commutator = =,
104+
-- negator = <>,
105+
procedure = ipaddr_eq
106+
);
107+
108+
create operator >= (
109+
leftarg = ipaddr,
110+
rightarg = ipaddr,
111+
negator = <,
112+
procedure = ipaddr_ge
113+
);
114+
115+
create operator > (
116+
leftarg = ipaddr,
117+
rightarg = ipaddr,
118+
negator = <=,
119+
procedure = ipaddr_gt
120+
);
121+
122+
create operator <> (
123+
leftarg = ipaddr,
124+
rightarg = ipaddr,
125+
negator = =,
126+
procedure = ipaddr_ne
127+
);
128+
129+
--
130+
-- eof
131+
--

contrib/ip_and_mac/mac.sql.in

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
--
2+
-- PostgreSQL code for MAC addresses.
3+
--
4+
-- $Id: mac.sql.in,v 1.1 1998/04/22 04:20:36 scrappy Exp $
5+
--
6+
7+
load '_OBJWD_/mac_DLSUFFIX_';
8+
9+
--
10+
-- Input and output functions and the type itself:
11+
--
12+
13+
create function macaddr_in(opaque)
14+
returns opaque
15+
as '_OBJWD_/mac_DLSUFFIX_'
16+
language 'c';
17+
18+
create function macaddr_out(opaque)
19+
returns opaque
20+
as '_OBJWD_/mac_DLSUFFIX_'
21+
language 'c';
22+
23+
create type macaddr (
24+
internallength = 6,
25+
externallength = variable,
26+
input = macaddr_in,
27+
output = macaddr_out
28+
);
29+
30+
--
31+
-- The boolean tests:
32+
--
33+
34+
create function macaddr_lt(macaddr, macaddr)
35+
returns bool
36+
as '_OBJWD_/mac_DLSUFFIX_'
37+
language 'c';
38+
39+
create function macaddr_le(macaddr, macaddr)
40+
returns bool
41+
as '_OBJWD_/mac_DLSUFFIX_'
42+
language 'c';
43+
44+
create function macaddr_eq(macaddr, macaddr)
45+
returns bool
46+
as '_OBJWD_/mac_DLSUFFIX_'
47+
language 'c';
48+
49+
create function macaddr_ge(macaddr, macaddr)
50+
returns bool
51+
as '_OBJWD_/mac_DLSUFFIX_'
52+
language 'c';
53+
54+
create function macaddr_gt(macaddr, macaddr)
55+
returns bool
56+
as '_OBJWD_/mac_DLSUFFIX_'
57+
language 'c';
58+
59+
create function macaddr_ne(macaddr, macaddr)
60+
returns bool
61+
as '_OBJWD_/mac_DLSUFFIX_'
62+
language 'c';
63+
64+
--
65+
-- Now the operators. Note how some of the parameters to some
66+
-- of the 'create operator' commands are commented out. This
67+
-- is because they reference as yet undefined operators, and
68+
-- will be implicitly defined when those are, further down.
69+
--
70+
71+
create operator < (
72+
leftarg = macaddr,
73+
rightarg = macaddr,
74+
-- negator = >=,
75+
procedure = macaddr_lt
76+
);
77+
78+
create operator <= (
79+
leftarg = macaddr,
80+
rightarg = macaddr,
81+
-- negator = >,
82+
procedure = macaddr_le
83+
);
84+
85+
create operator = (
86+
leftarg = macaddr,
87+
rightarg = macaddr,
88+
commutator = =,
89+
-- negator = <>,
90+
procedure = macaddr_eq
91+
);
92+
93+
create operator >= (
94+
leftarg = macaddr,
95+
rightarg = macaddr,
96+
negator = <,
97+
procedure = macaddr_ge
98+
);
99+
100+
create operator > (
101+
leftarg = macaddr,
102+
rightarg = macaddr,
103+
negator = <=,
104+
procedure = macaddr_gt
105+
);
106+
107+
create operator <> (
108+
leftarg = macaddr,
109+
rightarg = macaddr,
110+
negator = =,
111+
procedure = macaddr_ne
112+
);
113+
114+
--
115+
-- Finally, the special manufacurer matching function:
116+
--
117+
118+
create function macaddr_manuf(macaddr)
119+
returns text
120+
as '_OBJWD_/mac_DLSUFFIX_'
121+
language 'c';
122+
123+
--
124+
-- eof
125+
--

contrib/soundex/Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for soundex
5+
#
6+
#-------------------------------------------------------------------------
7+
8+
PGDIR = ../..
9+
SRCDIR = $(PGDIR)/src
10+
11+
include $(SRCDIR)/Makefile.global
12+
13+
INCLUDE_OPT = -I ./ \
14+
-I $(SRCDIR)/ \
15+
-I $(SRCDIR)/include \
16+
-I $(SRCDIR)/interfaces/libpq \
17+
-I $(SRCDIR)/port/$(PORTNAME)
18+
19+
CFLAGS += $(INCLUDE_OPT)
20+
21+
ifeq ($(PORTNAME), linux)
22+
ifdef LINUX_ELF
23+
ifeq ($(CC), gcc)
24+
CFLAGS += -fPIC
25+
endif
26+
endif
27+
endif
28+
29+
ifeq ($(PORTNAME), i386_solaris)
30+
CFLAGS+= -fPIC
31+
endif
32+
33+
MODNAME = soundex
34+
35+
MODULE = $(MODNAME)$(DLSUFFIX)
36+
37+
all: module sql
38+
39+
module: $(MODULE)
40+
41+
sql: $(MODNAME).sql
42+
43+
install: $(MODULE)
44+
cp -p $(MODULE) $(LIBDIR)/modules
45+
cd $(LIBDIR)/modules; strip $(MODULE)
46+
47+
%.sql: %.sql.in
48+
sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
49+
50+
.SUFFIXES: $(DLSUFFIX)
51+
52+
%$(DLSUFFIX): %.c
53+
$(CC) $(CFLAGS) -shared -o $@ $<
54+
55+
depend dep:
56+
$(CC) -MM $(INCLUDE_OPT) *.c >depend
57+
58+
clean:
59+
rm -f $(MODULE) $(MODNAME).sql
60+
61+
ifeq (depend,$(wildcard depend))
62+
include depend
63+
endif

contrib/soundex/soundex.sql.in

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
--------------- soundex.sql:
2+
3+
CREATE FUNCTION text_soundex(text) RETURNS text
4+
AS '_OBJWD_/soundex.so' LANGUAGE 'c';
5+
6+
SELECT text_soundex('hello world!');
7+
8+
CREATE TABLE s (nm text)\g
9+
10+
insert into s values ('john')\g
11+
insert into s values ('joan')\g
12+
insert into s values ('wobbly')\g
13+
14+
select * from s
15+
where text_soundex(nm) = text_soundex('john')\g
16+
17+
select nm from s a, s b
18+
where text_soundex(a.nm) = text_soundex(b.nm)
19+
and a.oid <> b.oid\g
20+
21+
CREATE FUNCTION text_sx_eq(text, text) RETURNS bool AS
22+
'select text_soundex($1) = text_soundex($2)'
23+
LANGUAGE 'sql'\g
24+
25+
CREATE FUNCTION text_sx_lt(text,text) RETURNS bool AS
26+
'select text_soundex($1) < text_soundex($2)'
27+
LANGUAGE 'sql'\g
28+
29+
CREATE FUNCTION text_sx_gt(text,text) RETURNS bool AS
30+
'select text_soundex($1) > text_soundex($2)'
31+
LANGUAGE 'sql';
32+
33+
CREATE FUNCTION text_sx_le(text,text) RETURNS bool AS
34+
'select text_soundex($1) <= text_soundex($2)'
35+
LANGUAGE 'sql';
36+
37+
CREATE FUNCTION text_sx_ge(text,text) RETURNS bool AS
38+
'select text_soundex($1) >= text_soundex($2)'
39+
LANGUAGE 'sql';
40+
41+
CREATE FUNCTION text_sx_ne(text,text) RETURNS bool AS
42+
'select text_soundex($1) <> text_soundex($2)'
43+
LANGUAGE 'sql';
44+
45+
DROP OPERATOR #= (text,text)\g
46+
47+
CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq,
48+
commutator=text_sx_eq)\g
49+
50+
SELECT *
51+
FROM s
52+
WHERE text_sx_eq(nm,'john')\g
53+
54+
SELECT *
55+
from s
56+
where s.nm #= 'john';
57+

0 commit comments

Comments
 (0)