Kannel: Open Source WAP and SMS gateway  svn-r5335
sqlbox_pgsql.h
Go to the documentation of this file.
1 #include "gwlib/gwlib.h"
2 
3 #if defined(HAVE_PGSQL) || defined(HAVE_SDB)
4 
5 #define SQLBOX_PGSQL_CREATE_LOG_TABLE "CREATE TABLE %S (sql_id SERIAL PRIMARY KEY, \
6 momt VARCHAR(3) CHECK(momt IN ('MO', 'MT', 'DLR', NULL)) DEFAULT NULL, \
7 sender VARCHAR(20) NULL, receiver VARCHAR(20) NULL, udhdata VARCHAR(255) NULL, \
8 msgdata TEXT NULL, time BIGINT NULL, smsc_id VARCHAR(255) NULL, \
9 service VARCHAR(255) NULL, account VARCHAR(255) NULL, id BIGINT NULL, \
10 sms_type BIGINT NULL, mclass BIGINT NULL, mwi BIGINT NULL, coding BIGINT NULL, \
11 compress BIGINT NULL, validity BIGINT NULL, deferred BIGINT NULL, \
12 dlr_mask BIGINT NULL, dlr_url VARCHAR(255) NULL, pid BIGINT NULL, \
13 alt_dcs BIGINT NULL, rpi BIGINT NULL, charset VARCHAR(255) NULL, \
14 boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL, meta_data TEXT NULL, foreign_id VARCHAR(255) NULL)"
15 
16 #define SQLBOX_PGSQL_CREATE_INSERT_TABLE "CREATE TABLE %S (sql_id SERIAL PRIMARY KEY, \
17 momt VARCHAR(3) CHECK(momt IN ('MO', 'MT', NULL)) DEFAULT NULL, \
18 sender VARCHAR(20) NULL, receiver VARCHAR(20) NULL, udhdata VARCHAR(255) NULL, \
19 msgdata TEXT NULL, time BIGINT NULL, smsc_id VARCHAR(255) NULL, \
20 service VARCHAR(255) NULL, account VARCHAR(255) NULL, id BIGINT NULL, \
21 sms_type BIGINT NULL, mclass BIGINT NULL, mwi BIGINT NULL, coding BIGINT NULL, \
22 compress BIGINT NULL, validity BIGINT NULL, deferred BIGINT NULL, \
23 dlr_mask BIGINT NULL, dlr_url VARCHAR(255) NULL, pid BIGINT NULL, \
24 alt_dcs BIGINT NULL, rpi BIGINT NULL, charset VARCHAR(255) NULL, \
25 boxc_id VARCHAR(255) NULL, binfo VARCHAR(255) NULL, meta_data TEXT NULL, foreign_id VARCHAR(255) NULL)"
26 
27 #define SQLBOX_PGSQL_SELECT_QUERY "SELECT sql_id, momt, sender, receiver, udhdata, msgdata, \
28 time, smsc_id, service, account, id, sms_type, mclass, mwi, coding, compress, validity, deferred, \
29 dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo, meta_data FROM %S LIMIT 1 OFFSET 0"
30 
31 #define SQLBOX_PGSQL_INSERT_QUERY "INSERT INTO %S (momt, sender, receiver, udhdata, msgdata, \
32 time, smsc_id, service, account, sms_type, mclass, mwi, coding, compress, validity, deferred, \
33 dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo, meta_data, foreign_id) VALUES (%S, %S, %S, \
34 %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S, %S)"
35 
36 #define SQLBOX_PGSQL_DELETE_QUERY "DELETE FROM %S WHERE sql_id = %S"
37 
38 #endif /* HAVE_PGSQL || HAVE_SDB */
39 
40 #ifdef HAVE_PGSQL
41 #include "gw/msg.h"
42 #include "sqlbox_sql.h"
43 #define sql_fetch_msg pgsql_fetch_msg
44 #define sql_save_msg pgsql_save_msg
45 #define sql_leave pgsql_leave
46 void sql_save_msg(Msg *msg, Octstr *momt /*, Octstr smsbox_id */);
47 Msg *pgsql_fetch_msg();
48 void sql_shutdown();
49 struct server_type *sqlbox_init_pgsql(Cfg *cfg);
50 void sqlbox_configure_pgsql(Cfg *cfg);
51 extern Octstr *sqlbox_id;
52 #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.