Kannel: Open Source WAP and SMS gateway  svn-r5335
sqlbox_sql.h
Go to the documentation of this file.
1 #ifndef SQLBOX_SQL_H
2 #define SQLBOX_SQL_H
3 #include "gwlib/gwlib.h"
4 #include "gw/msg.h"
5 #include "sqlbox_mssql.h"
6 #include "sqlbox_mysql.h"
7 #include "sqlbox_oracle.h"
8 #include "sqlbox_pgsql.h"
9 #include "sqlbox_sdb.h"
10 #include "sqlbox_sqlite.h"
11 #include "sqlbox_sqlite3.h"
12 
13 struct server_type {
15  void (*sql_enter) (Cfg *);
16  void (*sql_leave) ();
17  Msg *(*sql_fetch_msg) ();
18  void (*sql_save_msg) (Msg *, Octstr *);
19  int (*sql_fetch_msg_list) (List *, long);
20  void (*sql_save_list) (List *, Octstr *, int);
21 };
22 
30  char *select_query;
31  char *delete_query;
32  char *insert_query;
33 };
34 
36 
37 #ifndef sqlbox_sql_c
38 extern
39 #endif
40 struct server_type *sql_type;
41 
42 #define gw_sql_fetch_msg sql_type->sql_fetch_msg
43 #define gw_sql_fetch_msg_list sql_type->sql_fetch_msg_list
44 #define gw_sql_save_list sql_type->sql_save_list
45 #define gw_sql_save_msg(message, table) \
46  do { \
47  octstr_url_encode(message->sms.msgdata); \
48  octstr_url_encode(message->sms.udhdata); \
49  sql_type->sql_save_msg(message, table); \
50  } while (0)
51 #define gw_sql_enter sql_type->sql_enter
52 #define gw_sql_leave sql_type->sql_leave
53 
54 /* Macro to run the queries to create tables */
55 #define sqlbox_run_query(query, table) \
56 if (query != NULL) { \
57  sql = octstr_format(query, table, table, table); \
58  sql_update(pc, sql); \
59  octstr_destroy(sql); \
60 }
61 
62 #undef SQLBOX_TRACE
63 
64 #endif
int(* sql_fetch_msg_list)(List *, long)
Definition: sqlbox_sql.h:19
struct server_type * sqlbox_init_sql(Cfg *cfg)
Definition: sqlbox_sql.c:4
char * delete_query
Definition: sqlbox_sql.h:31
char * create_log_trigger
Definition: sqlbox_sql.h:29
void(* sql_save_list)(List *, Octstr *, int)
Definition: sqlbox_sql.h:20
static Cfg * cfg
Definition: opensmppbox.c:95
void(* sql_leave)()
Definition: sqlbox_sql.h:16
void(* sql_enter)(Cfg *)
Definition: sqlbox_sql.h:15
char * select_query
Definition: sqlbox_sql.h:30
Definition: msg.h:79
Definition: cfg.c:164
char * create_log_sequence
Definition: sqlbox_sql.h:28
Definition: octstr.c:118
char * create_insert_trigger
Definition: sqlbox_sql.h:26
char * create_insert_table
Definition: sqlbox_sql.h:24
Octstr * type
Definition: sqlbox_sql.h:14
char * create_insert_sequence
Definition: sqlbox_sql.h:25
struct server_type * sql_type
char * insert_query
Definition: sqlbox_sql.h:32
char * create_log_table
Definition: sqlbox_sql.h:27
Definition: list.c:102
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.