1Mail::SpamAssassin::BayUesseSrtoCroen:t:rPigbSuQtLe(d3M)Paeirll::DSopcaummAesnstaastsiionn::BayesStore::PgSQL(3)
2
3
4
6 Mail::SpamAssassin::BayesStore::PgSQL - PostgreSQL Specific Bayesian
7 Storage Module Implementation
8
11 This module implements a PostgreSQL specific bayesian storage module.
12
13 It subclasses Mail::SpamAssassin::BayesStore::SQL and overrides any
14 methods which makes SQL calls involving the token column. Since
15 PostgreSQL uses BYTEA for the token column type you must make sure that
16 the DBD driver does the proper quoting. You can accomplish this by
17 binding the token column to a specific type.
18
20 token_expiration
21 public instance (Integer, Integer,
22 Integer, Integer) token_expiration(\% $opts,
23 Integer $newdelta,
24 @ @vars)
25
26 Description: This method performs the database specific expiration of
27 tokens based on the passed in $newdelta and @vars.
28
29 seen_put
30 public (Boolean) seen_put (string $msgid, char $flag)
31
32 Description: This method records $msgid as the type given by $flag.
33 $flag is one of two values 's' for spam and 'h' for ham.
34
35 seen_delete
36 public instance (Boolean) seen_delete (string $msgid)
37
38 Description: This method removes $msgid from the database.
39
40 set_last_expire
41 public instance (Boolean) set_last_expire (Integer $time)
42
43 Description: This method sets the last expire time.
44
45 set_running_expire_tok
46 public instance (String $time) set_running_expire_tok ()
47
48 Description: This method sets the time that an expire starts running.
49
50 remove_running_expire_tok
51 public instance (Boolean) remove_running_expire_tok ()
52
53 Description: This method removes the row in the database that indicates
54 that and expire is currently running.
55
56 tok_get
57 public instance (Integer, Integer, Integer) tok_get (String $token)
58
59 Description: This method retrieves a specificed token ($token) from the
60 database and returns it's spam_count, ham_count and last access time.
61
62 tok_get_all
63 public instance (\@) tok_get (@ $tokens)
64
65 Description: This method retrieves the specified tokens ($tokens) from
66 storage and returns an array ref of arrays spam count, ham acount and
67 last access time.
68
69 nspam_nham_change
70 public instance (Boolean) nspam_nham_change (Integer $num_spam,
71 Integer $num_ham)
72
73 Description: This method updates the number of spam and the number of
74 ham in the database.
75
76 tok_touch
77 public instance (Boolean) tok_touch (String $token,
78 String $atime)
79
80 Description: This method updates the given tokens ($token) atime.
81
82 The assumption is that the token already exists in the database.
83
84 tok_touch_all
85 public instance (Boolean) tok_touch (\@ $tokens
86 String $atime)
87
88 Description: This method does a mass update of the given list of tokens
89 $tokens, if the existing token atime is < $atime.
90
91 The assumption is that the tokens already exist in the database.
92
93 We should never be touching more than N_SIGNIFICANT_TOKENS, so we can
94 make some assumptions about how to handle the data (ie no need to batch
95 like we do in tok_get_all)
96
97 cleanup
98 public instance (Boolean) cleanup ()
99
100 Description: This method perfoms any cleanup necessary before moving
101 onto the next operation.
102
103 clear_database
104 public instance (Boolean) clear_database ()
105
106 Description: This method deletes all records for a particular user.
107
108 Callers should be aware that any errors returned by this method could
109 causes the database to be inconsistent for the given user.
110
112 _connect_db
113 private instance (Boolean) _connect_db ()
114
115 Description: This method connects to the SQL database.
116
117 _put_token
118 private instance (Boolean) _put_token (string $token,
119 integer $spam_count,
120 integer $ham_count,
121 string $atime)
122
123 Description: This method performs the work of either inserting or
124 updating a token in the database.
125
126 _put_tokens
127 private instance (Boolean) _put_tokens (\% $token,
128 integer $spam_count,
129 integer $ham_count,
130 string $atime)
131
132 Description: This method performs the work of either inserting or
133 updating tokens in the database.
134
135 _token_select_string
136 private instance (String) _token_select_string
137
138 Description: This method returns the string to be used in SELECT
139 statements to represent the token column.
140
141
142
143perl v5.16.3 2014-M0a2i-l0:7:SpamAssassin::BayesStore::PgSQL(3)