1Mail::SpamAssassin::BayUesseSrtoCroen:t:rMiybSuQtLe(d3M)Paeirll::DSopcaummAesnstaastsiionn::BayesStore::MySQL(3)
2
3
4
6 Mail::SpamAssassin::BayesStore::MySQL - MySQL Specific Bayesian Storage
7 Module Implementation
8
10 This module implements a MySQL specific based bayesian storage module.
11 It requires that you are running at least version 4.1 of MySQL, if you
12 are running a version of MySQL < 4.1 then several aspects of this
13 module will fail and possibly corrupt your bayes database data.
14
15 In addition, this module will support rollback on error, if you are
16 using the InnoDB database table type in MySQL. For more information
17 please review the instructions in sql/README.bayes.
18
19 This module is also compatible with MariaDB and DBD::MariaDB can be
20 used instead of DBD::mysql driver.
21
23 token_expiration
24 public instance (Integer, Integer,
25 Integer, Integer) token_expiration(\% $opts,
26 Integer $newdelta,
27 @ @vars)
28
29 Description: This method performs the database specific expiration of
30 tokens based on the passed in $newdelta and @vars.
31
32 seen_put
33 public (Boolean) seen_put (string $msgid, char $flag)
34
35 Description: This method records $msgid as the type given by $flag.
36 $flag is one of two values 's' for spam and 'h' for ham.
37
38 seen_delete
39 public instance (Boolean) seen_delete (string $msgid)
40
41 Description: This method removes $msgid from the database.
42
43 set_last_expire
44 public instance (Boolean) set_last_expire (Integer $time)
45
46 Description: This method sets the last expire time.
47
48 set_running_expire_tok
49 public instance (String $time) set_running_expire_tok ()
50
51 Description: This method sets the time that an expire starts running.
52
53 remove_running_expire_tok
54 public instance (Boolean) remove_running_expire_tok ()
55
56 Description: This method removes the row in the database that indicates
57 that and expire is currently running.
58
59 tok_get
60 public instance (Integer, Integer, Integer) tok_get (String $token)
61
62 Description: This method retrieves a specified token ($token) from the
63 database and returns it's spam_count, ham_count and last access time.
64
65 tok_get_all
66 public instance (\@) tok_get (@ $tokens)
67
68 Description: This method retrieves the specified tokens ($tokens) from
69 storage and returns an array ref of arrays spam count, ham count and
70 last access time.
71
72 nspam_nham_change
73 public instance (Boolean) nspam_nham_change (Integer $num_spam,
74 Integer $num_ham)
75
76 Description: This method updates the number of spam and the number of
77 ham in the database.
78
79 tok_touch
80 public instance (Boolean) tok_touch (String $token,
81 String $atime)
82
83 Description: This method updates the given tokens ($token) atime.
84
85 The assumption is that the token already exists in the database.
86
87 tok_touch_all
88 public instance (Boolean) tok_touch (\@ $tokens
89 String $atime)
90
91 Description: This method does a mass update of the given list of tokens
92 $tokens, if the existing token atime is < $atime.
93
94 The assumption is that the tokens already exist in the database.
95
96 We should never be touching more than N_SIGNIFICANT_TOKENS, so we can
97 make some assumptions about how to handle the data (ie no need to batch
98 like we do in tok_get_all)
99
100 cleanup
101 public instance (Boolean) cleanup ()
102
103 Description: This method performs any cleanup necessary before moving
104 onto the next operation.
105
106 clear_database
107 public instance (Boolean) clear_database ()
108
109 Description: This method deletes all records for a particular user.
110
111 Callers should be aware that any errors returned by this method could
112 causes the database to be inconsistent for the given user.
113
115 _connect_db
116 private instance (Boolean) _connect_db ()
117
118 Description: This method connects to the SQL database.
119
120 _initialize_db
121 private instance (Boolean) _initialize_db ()
122
123 Description: This method will check to see if a user has had their
124 bayes variables initialized. If not then it will perform this
125 initialization.
126
127 _put_token
128 private instance (Boolean) _put_token (string $token,
129 integer $spam_count,
130 integer $ham_count,
131 string $atime)
132
133 Description: This method performs the work of either inserting or
134 updating a token in the database.
135
136 _put_tokens
137 private instance (Boolean) _put_tokens (\% $tokens,
138 integer $spam_count,
139 integer $ham_count,
140 string $atime)
141
142 Description: This method performs the work of either inserting or
143 updating tokens in the database.
144
145 _token_select_string
146 private instance (String) _token_select_string
147
148 Description: This method returns the string to be used in SELECT
149 statements to represent the token column.
150
151 The default is to use the RPAD function to pad the token out to 5
152 characters.
153
154
155
156perl v5.38.0 2023-M0a7i-l2:2:SpamAssassin::BayesStore::MySQL(3)