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

Commitce3d087

Browse files
committed
This patch adds support for inet[] arrays to the /contrib/array module.
Neil Conway
1 parent0b15c25 commitce3d087

File tree

3 files changed

+102
-28
lines changed

3 files changed

+102
-28
lines changed

‎contrib/array/array_iterator.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,41 @@ array_all_oidne(ArrayType *array, Oid value)
361361
array, (Datum)value);
362362
}
363363

364-
/* end of file */
364+
int32
365+
array_ineteq(ArrayType*array,Oidvalue)
366+
{
367+
returnarray_iterator((Oid)869,/* inet */
368+
(Oid)920,/* network_eq */
369+
0,/* logical or */
370+
array, (Datum)value);
371+
}
372+
373+
int32
374+
array_all_ineteq(ArrayType*array,Oidvalue)
375+
{
376+
returnarray_iterator((Oid)869,/* inet */
377+
(Oid)920,/* network_eq */
378+
1,/* logical and */
379+
array, (Datum)value);
380+
}
381+
382+
int32
383+
array_inetne(ArrayType*array,Oidvalue)
384+
{
385+
returnarray_iterator((Oid)869,/* inet */
386+
(Oid)925,/* network_ne */
387+
0,/* logical and */
388+
array, (Datum)value);
389+
}
390+
391+
int32
392+
array_all_inetne(ArrayType*array,Oidvalue)
393+
{
394+
returnarray_iterator((Oid)869,/* inet */
395+
(Oid)925,/* network_ne */
396+
1,/* logical and */
397+
array, (Datum)value);
398+
}
365399

366400
/*
367401
* Local Variables:

‎contrib/array/array_iterator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ int32array_all_int4le(ArrayType *array, int4 value);
3434

3535
int32array_oideq(ArrayType*array,Oidvalue);
3636
int32array_all_oidne(ArrayType*array,Oidvalue);
37+
38+
int32array_ineteq(ArrayType*array,Oidvalue);
39+
int32array_all_ineteq(ArrayType*array,Oidvalue);
40+
int32array_inetne(ArrayType*array,Oidvalue);
41+
int32array_all_inetne(ArrayType*array,Oidvalue);
3742
#endif
3843

3944
/*

‎contrib/array/array_iterator.sql.in

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
-- define the array operators *=, **=, *~ and **~ for type _text
44
--
5-
create function array_texteq(_text, text) returns bool
5+
createor replacefunction array_texteq(_text, text) returns bool
66
as 'MODULE_PATHNAME'
77
language 'c';
88

9-
create function array_all_texteq(_text, text) returns bool
9+
createor replacefunction array_all_texteq(_text, text) returns bool
1010
as 'MODULE_PATHNAME'
1111
language 'c';
1212

13-
create function array_textregexeq(_text, text) returns bool
13+
createor replacefunction array_textregexeq(_text, text) returns bool
1414
as 'MODULE_PATHNAME'
1515
language 'c';
1616

17-
create function array_all_textregexeq(_text, text) returns bool
17+
createor replacefunction array_all_textregexeq(_text, text) returns bool
1818
as 'MODULE_PATHNAME'
1919
language 'c';
2020

@@ -43,19 +43,19 @@ create operator **~ (
4343
--
4444
-- NOTE: "varchar" is also a reserved word and must be quoted.
4545
--
46-
create function array_varchareq(_varchar, varchar) returns bool
46+
createor replacefunction array_varchareq(_varchar, varchar) returns bool
4747
as 'MODULE_PATHNAME'
4848
language 'c';
4949

50-
create function array_all_varchareq(_varchar, varchar) returns bool
50+
createor replacefunction array_all_varchareq(_varchar, varchar) returns bool
5151
as 'MODULE_PATHNAME'
5252
language 'c';
5353

54-
create function array_varcharregexeq(_varchar, varchar) returns bool
54+
createor replacefunction array_varcharregexeq(_varchar, varchar) returns bool
5555
as 'MODULE_PATHNAME'
5656
language 'c';
5757

58-
create function array_all_varcharregexeq(_varchar, varchar) returns bool
58+
createor replacefunction array_all_varcharregexeq(_varchar, varchar) returns bool
5959
as 'MODULE_PATHNAME'
6060
language 'c';
6161

@@ -82,19 +82,19 @@ create operator **~ (
8282

8383
-- define the array operators *=, **=, *~ and **~ for type _bpchar
8484
--
85-
create function array_bpchareq(_bpchar, bpchar) returns bool
85+
createor replacefunction array_bpchareq(_bpchar, bpchar) returns bool
8686
as 'MODULE_PATHNAME'
8787
language 'c';
8888

89-
create function array_all_bpchareq(_bpchar, bpchar) returns bool
89+
createor replacefunction array_all_bpchareq(_bpchar, bpchar) returns bool
9090
as 'MODULE_PATHNAME'
9191
language 'c';
9292

93-
create function array_bpcharregexeq(_bpchar, bpchar) returns bool
93+
createor replacefunction array_bpcharregexeq(_bpchar, bpchar) returns bool
9494
as 'MODULE_PATHNAME'
9595
language 'c';
9696

97-
create function array_all_bpcharregexeq(_bpchar, bpchar) returns bool
97+
createor replacefunction array_all_bpcharregexeq(_bpchar, bpchar) returns bool
9898
as 'MODULE_PATHNAME'
9999
language 'c';
100100

@@ -121,51 +121,51 @@ create operator **~ (
121121

122122
-- define the array operators *=, **=, *> and **> for type _int4
123123
--
124-
create function array_int4eq(_int4, int4) returns bool
124+
createor replacefunction array_int4eq(_int4, int4) returns bool
125125
as 'MODULE_PATHNAME'
126126
language 'c';
127127

128-
create function array_all_int4eq(_int4, int4) returns bool
128+
createor replacefunction array_all_int4eq(_int4, int4) returns bool
129129
as 'MODULE_PATHNAME'
130130
language 'c';
131131

132-
create function array_int4ne(_int4, int4) returns bool
132+
createor replacefunction array_int4ne(_int4, int4) returns bool
133133
as 'MODULE_PATHNAME'
134134
language 'c';
135135

136-
create function array_all_int4ne(_int4, int4) returns bool
136+
createor replacefunction array_all_int4ne(_int4, int4) returns bool
137137
as 'MODULE_PATHNAME'
138138
language 'c';
139139

140-
create function array_int4gt(_int4, int4) returns bool
140+
createor replacefunction array_int4gt(_int4, int4) returns bool
141141
as 'MODULE_PATHNAME'
142142
language 'c';
143143

144-
create function array_all_int4gt(_int4, int4) returns bool
144+
createor replacefunction array_all_int4gt(_int4, int4) returns bool
145145
as 'MODULE_PATHNAME'
146146
language 'c';
147147

148-
create function array_int4ge(_int4, int4) returns bool
148+
createor replacefunction array_int4ge(_int4, int4) returns bool
149149
as 'MODULE_PATHNAME'
150150
language 'c';
151151

152-
create function array_all_int4ge(_int4, int4) returns bool
152+
createor replacefunction array_all_int4ge(_int4, int4) returns bool
153153
as 'MODULE_PATHNAME'
154154
language 'c';
155155

156-
create function array_int4lt(_int4, int4) returns bool
156+
createor replacefunction array_int4lt(_int4, int4) returns bool
157157
as 'MODULE_PATHNAME'
158158
language 'c';
159159

160-
create function array_all_int4lt(_int4, int4) returns bool
160+
createor replacefunction array_all_int4lt(_int4, int4) returns bool
161161
as 'MODULE_PATHNAME'
162162
language 'c';
163163

164-
create function array_int4le(_int4, int4) returns bool
164+
createor replacefunction array_int4le(_int4, int4) returns bool
165165
as 'MODULE_PATHNAME'
166166
language 'c';
167167

168-
create function array_all_int4le(_int4, int4) returns bool
168+
createor replacefunction array_all_int4le(_int4, int4) returns bool
169169
as 'MODULE_PATHNAME'
170170
language 'c';
171171

@@ -231,11 +231,11 @@ create operator **<= (
231231

232232
-- define the array operators *=, **<> for type _oid (added tobias 1. 1999)
233233
--
234-
create function array_oideq(_oid, oid) returns bool
234+
createor replacefunction array_oideq(_oid, oid) returns bool
235235
as 'MODULE_PATHNAME'
236236
language 'c';
237237

238-
create function array_all_oidne(_oid, oid) returns bool
238+
createor replacefunction array_all_oidne(_oid, oid) returns bool
239239
as 'MODULE_PATHNAME'
240240
language 'c';
241241

@@ -249,5 +249,40 @@ create operator **<> (
249249
rightarg=oid,
250250
procedure=array_all_oidne);
251251

252+
-- define the array operators *=, **=, *<>, **<> for type _inet
252253

253-
-- end of file
254+
create or replace function array_ineteq(_inet, inet) returns bool
255+
as 'MODULE_PATHNAME'
256+
language 'c';
257+
258+
create or replace function array_all_ineteq(_inet, inet) returns bool
259+
as 'MODULE_PATHNAME'
260+
language 'c';
261+
262+
create or replace function array_inetne(_inet, inet) returns bool
263+
as 'MODULE_PATHNAME'
264+
language 'c';
265+
266+
create or replace function array_all_inetne(_inet, inet) returns bool
267+
as 'MODULE_PATHNAME'
268+
language 'c';
269+
270+
create operator *= (
271+
leftarg=_inet,
272+
rightarg=inet,
273+
procedure=array_ineteq);
274+
275+
create operator **= (
276+
leftarg=_inet,
277+
rightarg=inet,
278+
procedure=array_all_ineteq);
279+
280+
create operator *<> (
281+
leftarg=_inet,
282+
rightarg=inet,
283+
procedure=array_inetne);
284+
285+
create operator **<> (
286+
leftarg=_inet,
287+
rightarg=inet,
288+
procedure=array_all_inetne);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp