Squid url redirector

Diff
anonymous

Diff

Differences From Artifact [83b3f67d5d]:

To Artifact [bb384fd21a]:


132
133
134
135
136
137
138
139
140
141
142


143
144
145
146
147
148
149
















150
151
152
153
154
155
156
157
-- this function adds tag to domain
CREATE or replace FUNCTION mark(domain text, new_tag text) RETURNS integer
	LANGUAGE sql immutable STRICT
	AS $$
select mark(get_site($1), $2) as result;
$$;

-- this function adds tag to domain with regexp
CREATE or replace FUNCTION mark(domain text, tags text[], regexp text) RETURNS integer
	LANGUAGE sql immutable STRICT
	AS $$


select mark(get_site($1), get_tag($2), $3) as result;
$$;

-- this function adds tag to domain with regexp
CREATE or replace FUNCTION mark(domain text, tags text[]) RETURNS integer
	LANGUAGE sql immutable STRICT
	AS $$
















select mark(get_site($1), get_tag($2), NULL) as result;
$$;

-- this function returns id of tag array
create or replace function get_tag(my_tag text[]) returns integer
	language plpgsql strict
	as $$
declare







|
|
|

>
>
|


|
|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
-- this function adds tag to domain
CREATE or replace FUNCTION mark(domain text, new_tag text) RETURNS integer
	LANGUAGE sql immutable STRICT
	AS $$
select mark(get_site($1), $2) as result;
$$;

-- this function sets tags for site/regexp pair
CREATE or replace FUNCTION set(my_id_site integer, my_id_tag integer) RETURNS integer
	LANGUAGE sql STRICT
	AS $$
delete from urls where $1 = id_site and regexp is null;
insert into urls (id_site, id_tag) values ($1, $2);
select $1;
$$;

-- this function sets tags for site/regexp pair
CREATE or replace FUNCTION set(my_id_site integer, my_id_tag integer, my_regexp text) RETURNS integer
	LANGUAGE sql STRICT
	AS $$
delete from urls where $1 = id_site and $3 = regexp;
insert into urls (id_site, id_tag, regexp) values ($1, $2, $3);
select $1;
$$;

-- this function stores new data for site/regexp pair
create or replace function set(domain text, tags text, regexp text) returns integer
	language sql immutable strict
	as $$
select set(get_site($1), get_tag($2::text[]), $3);
$$;

-- this function stores new data for site/regexp pair
create or replace function set(domain text, tags text) returns integer
	language sql immutable strict
	as $$
select set(get_site($1), get_tag($2::text[]));
$$;

-- this function returns id of tag array
create or replace function get_tag(my_tag text[]) returns integer
	language plpgsql strict
	as $$
declare