-
Notifications
You must be signed in to change notification settings - Fork 2
/
sphinxlink--1.4.sql
59 lines (50 loc) · 1.61 KB
/
sphinxlink--1.4.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION sphinxlink" to load this file. \quit
CREATE FUNCTION sphinx_connect(text, text DEFAULT '127.0.0.1', int DEFAULT 9306)
RETURNS text
AS 'MODULE_PATHNAME','sphinx_connect'
LANGUAGE C STRICT;
CREATE FUNCTION sphinx_disconnect(text)
RETURNS text
AS 'MODULE_PATHNAME', 'sphinx_disconnect'
LANGUAGE C STRICT;
CREATE FUNCTION sphinx_connections(OUT conname text, OUT host text, OUT port integer)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'sphinx_connections'
LANGUAGE C STRICT;
CREATE FUNCTION sphinx_query(text, text)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'sphinx_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION sphinx_query(text, text, text)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'sphinx_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION sphinx_query_params(text, integer, text)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'sphinx_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION sphinx_query_params(text, integer, text, text)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'sphinx_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION sphinx_meta(conname text)
RETURNS TABLE (varname text, value text)
AS
$$
BEGIN
RETURN QUERY
SELECT * FROM sphinx_query(conname, 'SHOW META') AS ss (varname text, value text);
END;
$$
LANGUAGE plpgsql;
CREATE FUNCTION sphinx_meta(host text, port integer)
RETURNS TABLE (varname text, value text)
AS
$$
BEGIN
RETURN QUERY
SELECT * FROM sphinx_query_params(host, port, 'SHOW META') AS ss (varname text, value text);
END;
$$
LANGUAGE plpgsql;