77 static DBPool *pool = NULL;
    85 static long dlr_messages_sqlite3()
    97 #if defined(DLR_TRACE)   119 static void dlr_shutdown_sqlite3()
   125 static void dlr_add_sqlite3(
struct dlr_entry *entry)
   132     debug(
"dlr.sqlite3", 0, 
"adding DLR entry into database");
   141     sql = 
octstr_format(
"INSERT INTO %S (%S, %S, %S, %S, %S, %S, %S, %S, %S) VALUES "   142                         "(?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, 0)",
   157 #if defined(DLR_TRACE)   172 static void dlr_remove_sqlite3(
const Octstr *smsc, 
const Octstr *ts, 
const Octstr *dst)
   178     debug(
"dlr.sqlite3", 0, 
"removing DLR from database");
   190     sql = 
octstr_format(
"DELETE FROM %S WHERE ROWID IN (SELECT ROWID FROM %S WHERE %S=?1 AND %S=?2 %S LIMIT 1)",
   199 #if defined(DLR_TRACE)   218     List *result = NULL, *row;
   231     sql = 
octstr_format(
"SELECT %S, %S, %S, %S, %S, %S FROM %S WHERE %S=?1 AND %S=?2 %S LIMIT 1",
   243 #if defined(DLR_TRACE)   256 #define LO2CSTR(r, i) octstr_get_cstr(gwlist_get(r, i))   262         res->
mask = atoi(LO2CSTR(row,0));
   280     Octstr *sql, *os_status, *like;
   285     debug(
"dlr.sqlite3", 0, 
"updating DLR status in database");
   297     sql = 
octstr_format(
"UPDATE %S SET %S=?1 WHERE ROWID IN (SELECT ROWID FROM %S WHERE %S=?2 AND %S=?3 %S LIMIT 1)",
   308 #if defined(DLR_TRACE)   323 static void dlr_flush_sqlite3 (
void)
   335 #if defined(DLR_TRACE)   340         error(0, 
"DLR: SQLite3: Error while flushing dlr entries from database");
   342         debug(
"dlr.sqlite3", 0, 
"Flushing %d DLR entries from database", rows);
   349     .dlr_messages = dlr_messages_sqlite3,
   350     .dlr_shutdown = dlr_shutdown_sqlite3,
   351     .dlr_add = dlr_add_sqlite3,
   352     .dlr_get = dlr_get_sqlite3,
   353     .dlr_remove = dlr_remove_sqlite3,
   354     .dlr_update = dlr_update_sqlite3,
   355     .dlr_flush = dlr_flush_sqlite3
   368         panic(0, 
"DLR: SQLite3: group 'dlr-db' is not specified!");
   371        panic(0, 
"DLR: SQLite3: directive 'id' is not specified!");
   392         panic(0, 
"DLR: SQLite3: connection settings for id '%s' are not specified!",
   400         panic(0, 
"DLR: SQLite3: connection settings missing for id '%s', please"   404     db_conf = gw_malloc(
sizeof(*db_conf));
   413         panic(0, 
"DLR: SQLite3: Could not establish sqlite3 connection(s).");
 void error(int err, const char *fmt,...)
 
long dbpool_conn_count(DBPool *p)
 
DBPool * dbpool_create(enum db_type db_type, DBConf *conf, unsigned int connections)
 
gw_assert(wtls_machine->packet_to_send !=NULL)
 
void gwlist_append(List *list, void *item)
 
void dlr_db_fields_destroy(struct dlr_db_fields *fields)
 
struct dlr_entry * dlr_entry_create(void)
 
long gwlist_len(List *list)
 
void * gwlist_get(List *list, long pos)
 
#define cfg_get(grp, varname)
 
#define octstr_get_cstr(ostr)
 
static struct pid_list * found
 
void dbpool_conn_produce(DBPoolConn *conn)
 
static struct dlr_storage * handles
 
Octstr * octstr_imm(const char *cstr)
 
void * gwlist_extract_first(List *list)
 
#define octstr_duplicate(ostr)
 
List * cfg_get_multi_group(Cfg *cfg, Octstr *name)
 
void warning(int err, const char *fmt,...)
 
Octstr * octstr_format(const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
#define octstr_create(cstr)
 
void octstr_destroy_item(void *os)
 
void dbpool_destroy(DBPool *p)
 
int dbpool_conn_update(DBPoolConn *conn, const Octstr *sql, List *binds)
 
void dlr_entry_destroy(struct dlr_entry *dlr)
 
void debug(const char *place, int err, const char *fmt,...)
 
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
 
int dbpool_conn_select(DBPoolConn *conn, const Octstr *sql, List *binds, List **result)
 
DBPoolConn * dbpool_conn_consume(DBPool *p)
 
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
 
struct dlr_db_fields * dlr_db_fields_create(CfgGroup *grp)
 
struct dlr_storage * dlr_init_sqlite3(Cfg *cfg)
 
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
 
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)