Skip to content

Commit

Permalink
Fixed usage of Prep Statement on failed CDRs.
Browse files Browse the repository at this point in the history
The number of inserted columns is variable (n+m or n+m+2), so we need different statements for each.
Reported by @apsaras (on GITHUB)
Closes #821

(cherry picked from commit e49e2e8)
  • Loading branch information
bogdan-iancu committed Mar 19, 2016
1 parent d2b5c52 commit d837ed8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/acc/acc.c
Expand Up @@ -602,7 +602,9 @@ int acc_db_request( struct sip_msg *rq, struct sip_msg *rpl,
query_list_t **ins_list, int cdr_flag)
{
static db_ps_t my_ps_ins = NULL;
static db_ps_t my_ps_ins2 = NULL;
static db_ps_t my_ps = NULL;
static db_ps_t my_ps2 = NULL;
int m;
int n;
int i;
Expand Down Expand Up @@ -636,7 +638,8 @@ int acc_db_request( struct sip_msg *rq, struct sip_msg *rpl,
}

acc_dbf.use_table(db_handle, &acc_env.text/*table*/);
CON_PS_REFERENCE(db_handle) = ins_list? &my_ps_ins : &my_ps;
CON_PS_REFERENCE(db_handle) = cdr_flag ?
(ins_list? &my_ps_ins2:&my_ps2) : (ins_list? &my_ps_ins:&my_ps);

/* multi-leg columns */
if ( !leg_info ) {
Expand Down

0 comments on commit d837ed8

Please sign in to comment.