-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpg_snakeoil--1.sql
40 lines (32 loc) · 1.6 KB
/
pg_snakeoil--1.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
\echo Use "CREATE EXTENSION pg_snakeoil" to load this file. \quit
-- ------------------------------------------------------------------------
-- Text Functions
-- ------------------------------------------------------------------------
-- Returns true if the given data matches a signature in the virus database
CREATE FUNCTION so_is_infected (text) RETURNS bool
AS 'MODULE_PATHNAME', 'so_is_infected'
LANGUAGE C IMMUTABLE STRICT;
-- Returns virus name if the given data matches a signature in the
-- virus database, empty string otherwise
CREATE FUNCTION so_virus_name (text) RETURNS text
AS 'MODULE_PATHNAME', 'so_virus_name'
LANGUAGE C IMMUTABLE STRICT;
-- ------------------------------------------------------------------------
-- bytea Functions
-- ------------------------------------------------------------------------
-- Returns true if the given data matches a signature in the virus database
CREATE FUNCTION so_is_infected (bytea) RETURNS bool
AS 'MODULE_PATHNAME', 'so_is_infected'
LANGUAGE C IMMUTABLE STRICT;
-- Returns virus name if the given data matches a signature in the
-- virus database, empty string otherwise
CREATE FUNCTION so_virus_name (bytea) RETURNS text
AS 'MODULE_PATHNAME', 'so_virus_name'
LANGUAGE C IMMUTABLE STRICT;
-- ------------------------------------------------------------------------
-- Management Functions
-- ------------------------------------------------------------------------
-- Update signatures, returns true if signatures changed, false otherwise
CREATE FUNCTION so_update_signatures () RETURNS bool
AS 'MODULE_PATHNAME', 'so_update_signatures'
LANGUAGE C IMMUTABLE STRICT;