Kannel: Open Source WAP and SMS gateway  svn-r5335
sqlbox_mysql.h
Go to the documentation of this file.
1 #include "gwlib/gwlib.h"
2 
3 #if defined(HAVE_MYSQL) || defined(HAVE_SDB)
4 
5 #define SQLBOX_MYSQL_CREATE_LOG_TABLE "CREATE TABLE IF NOT EXISTS %S ( \
6 sql_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, \
7 momt ENUM('MO', 'MT', 'DLR') NULL, sender VARCHAR(20) NULL, \
8 receiver VARCHAR(20) NULL, udhdata BLOB NULL, msgdata TEXT NULL, \
9 time BIGINT(20) NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, \
10 account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NULL, \
11 mclass BIGINT(20) NULL, mwi BIGINT(20) NULL, coding BIGINT(20) NULL, \
12 compress BIGINT(20) NULL, validity BIGINT(20) NULL, deferred BIGINT(20) NULL, \
13 dlr_mask BIGINT(20) NULL, dlr_url VARCHAR(255) NULL, pid BIGINT(20) NULL, \
14 alt_dcs BIGINT(20) NULL, rpi BIGINT(20) NULL, charset VARCHAR(255) NULL, \
15 boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL, meta_data TEXT, \
16 priority BIGINT(20) NULL, foreign_id VARCHAR(255) NULL)"
17 
18 #define SQLBOX_MYSQL_CREATE_INSERT_TABLE "CREATE TABLE IF NOT EXISTS %S ( \
19 sql_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, \
20 momt ENUM('MO', 'MT') NULL, sender VARCHAR(20) NULL, \
21 receiver VARCHAR(20) NULL, udhdata BLOB NULL, msgdata TEXT NULL, \
22 time BIGINT(20) NULL, smsc_id VARCHAR(255) NULL, service VARCHAR(255) NULL, \
23 account VARCHAR(255) NULL, id BIGINT(20) NULL, sms_type BIGINT(20) NULL, \
24 mclass BIGINT(20) NULL, mwi BIGINT(20) NULL, coding BIGINT(20) NULL, \
25 compress BIGINT(20) NULL, validity BIGINT(20) NULL, deferred BIGINT(20) NULL, \
26 dlr_mask BIGINT(20) NULL, dlr_url VARCHAR(255) NULL, pid BIGINT(20) NULL, \
27 alt_dcs BIGINT(20) NULL, rpi BIGINT(20) NULL, charset VARCHAR(255) NULL, \
28 boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL, meta_data TEXT, \
29 priority BIGINT(20) NULL, foreign_id VARCHAR(255) NULL)"
30 
31 #define SQLBOX_MYSQL_SELECT_QUERY "SELECT sql_id, momt, sender, receiver, udhdata, \
32 msgdata, time, smsc_id, service, account, id, sms_type, mclass, mwi, coding, \
33 compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, \
34 charset, boxc_id, binfo, meta_data, priority FROM %S LIMIT 0,1"
35 
36 #define SQLBOX_MYSQL_SELECT_LIST_QUERY "SELECT sql_id, momt, sender, receiver, udhdata, \
37 msgdata, time, smsc_id, service, account, id, sms_type, mclass, mwi, coding, \
38 compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, \
39 charset, boxc_id, binfo, meta_data, priority FROM %S LIMIT 0,%ld"
40 
41 #define SQLBOX_MYSQL_INSERT_QUERY "INSERT INTO %S ( sql_id, momt, sender, \
42 receiver, udhdata, msgdata, time, smsc_id, service, account, sms_type, \
43 mclass, mwi, coding, compress, validity, deferred, dlr_mask, dlr_url, \
44 pid, alt_dcs, rpi, charset, boxc_id, binfo, meta_data, priority, foreign_id ) VALUES ( \
45 NULL, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, \
46 %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S)"
47 
48 #define SQLBOX_MYSQL_INSERT_LIST_QUERY "INSERT INTO %S ( sql_id, momt, sender, \
49 receiver, udhdata, msgdata, time, smsc_id, service, account, sms_type, \
50 mclass, mwi, coding, compress, validity, deferred, dlr_mask, dlr_url, \
51 pid, alt_dcs, rpi, charset, boxc_id, binfo, meta_data, priority, foreign_id ) VALUES %S"
52 
53 #define SQLBOX_MYSQL_DELETE_QUERY "DELETE FROM %S WHERE sql_id = %S"
54 #define SQLBOX_MYSQL_DELETE_LIST_QUERY "DELETE FROM %S WHERE sql_id in (%S)"
55 
56 #endif /* HAVE_MYSQL || HAVE_SDB */
57 
58 #ifdef HAVE_MYSQL
59 #include "gw/msg.h"
60 #include "sqlbox_sql.h"
61 void sql_save_msg(Msg *msg, Octstr *momt);
62 Msg *mysql_fetch_msg();
63 void sql_shutdown();
64 struct server_type *sqlbox_init_mysql(Cfg* cfg);
65 extern Octstr *sqlbox_id;
66 #endif
static Cfg * cfg
Definition: opensmppbox.c:95
Definition: msg.h:79
Definition: cfg.c:164
Definition: octstr.c:118
Octstr * sqlbox_id
Definition: sqlbox.c:95
static XMLRPCDocument * msg
Definition: test_xmlrpc.c:86
void(* sql_save_msg)(Msg *, Octstr *)
Definition: sqlbox_sql.h:18
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.