77 static DBPool *pool = NULL;
85 static long dlr_messages_oracle()
97 #if defined(DLR_TRACE) 119 static void dlr_shutdown_oracle()
125 static void dlr_add_oracle(
struct dlr_entry *entry)
132 debug(
"dlr.oracle", 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_oracle(
const Octstr *smsc,
const Octstr *ts,
const Octstr *dst)
179 debug(
"dlr.oracle", 0,
"removing DLR from database");
191 sql =
octstr_format(
"DELETE FROM %S WHERE %S=:1 AND %S=:2 %S AND ROWNUM < 2",
200 #if defined(DLR_TRACE) 219 List *result = NULL, *row;
233 sql =
octstr_format(
"SELECT %S, %S, %S, %S, %S, %S FROM %S WHERE %S=:1 AND %S=:2 %S AND ROWNUM < 2",
245 #if defined(DLR_TRACE) 259 #define LO2CSTR(r, i) octstr_get_cstr(gwlist_get(r, i)) 265 res->
mask = atoi(LO2CSTR(row,0));
283 Octstr *sql, *os_status, *like;
288 debug(
"dlr.oracle", 0,
"updating DLR status in database");
300 sql =
octstr_format(
"UPDATE %S SET %S=:1 WHERE %S=:2 AND %S=:3 %S AND ROWNUM < 2",
311 #if defined(DLR_TRACE) 326 static void dlr_flush_oracle (
void)
338 #if defined(DLR_TRACE) 343 error(0,
"DLR: ORACLE: Error while flushing dlr entries from database");
345 debug(
"dlr.oracle", 0,
"Flushing %d DLR entries from database", rows);
352 .dlr_messages = dlr_messages_oracle,
353 .dlr_shutdown = dlr_shutdown_oracle,
354 .dlr_add = dlr_add_oracle,
355 .dlr_get = dlr_get_oracle,
356 .dlr_remove = dlr_remove_oracle,
357 .dlr_update = dlr_update_oracle,
358 .dlr_flush = dlr_flush_oracle
371 panic(0,
"DLR: ORACLE: group 'dlr-db' is not specified!");
374 panic(0,
"DLR: ORACLE: directive 'id' is not specified!");
395 panic(0,
"DLR: ORACLE: connection settings for id '%s' are not specified!",
405 panic(0,
"DLR: ORACLE: connection settings missing for id '%s', please" 409 db_conf = gw_malloc(
sizeof(*db_conf));
420 panic(0,
"DLR: ORACLE: Couldnot establish oracle 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
struct dlr_storage * dlr_init_oracle(Cfg *cfg)
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)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)