81        snprintf(new_columns, 
sizeof(new_columns), 
"%s", 
",peeraccount,linkedid,sequence");
 
   82        snprintf(new_values, 
sizeof(new_values), 
"%s", 
",?,?,?");
 
   86        snprintf(sqlcmd,
sizeof(sqlcmd),
"INSERT INTO %s " 
   87        "(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp," 
   88        "lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield%s) " 
   89        "VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?%s)", 
table, new_columns, timestr, new_values);
 
   91        snprintf(sqlcmd,
sizeof(sqlcmd),
"INSERT INTO %s " 
   92        "(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata," 
   93        "duration,billsec,disposition,amaflags,accountcode%s) " 
   94        "VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?%s)", 
table, new_columns, timestr, new_values);
 
   97    ODBC_res = SQLAllocHandle(SQL_HANDLE_STMT, obj->
con, &stmt);
 
   99    if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
 
  101        SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 
  105    SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
clid), 0, cdr->
clid, 0, 
NULL);
 
  106    SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
src), 0, cdr->
src, 0, 
NULL);
 
  107    SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
dst), 0, cdr->
dst, 0, 
NULL);
 
  108    SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
dcontext), 0, cdr->
dcontext, 0, 
NULL);
 
  109    SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
channel), 0, cdr->
channel, 0, 
NULL);
 
  110    SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
dstchannel), 0, cdr->
dstchannel, 0, 
NULL);
 
  111    SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
lastapp), 0, cdr->
lastapp, 0, 
NULL);
 
  112    SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
lastdata), 0, cdr->
lastdata, 0, 
NULL);
 
  115        double hrbillsec = 0.0;
 
  123        SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_FLOAT, 0, 0, &hrduration, 0, 
NULL);
 
  124        SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_FLOAT, 0, 0, &hrbillsec, 0, 
NULL);
 
  126        SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->
duration, 0, 
NULL);
 
  127        SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->
billsec, 0, 
NULL);
 
  133        SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(disposition) + 1, 0, disposition, 0, 
NULL);
 
  135        SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->
disposition, 0, 
NULL);
 
  137    SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->
amaflags, 0, 
NULL);
 
  142        SQLBindParameter(stmt, 14, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
uniqueid), 0, cdr->
uniqueid, 0, 
NULL);
 
  143        SQLBindParameter(stmt, 15, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
userfield), 0, cdr->
userfield, 0, 
NULL);
 
  149        SQLBindParameter(stmt, i + 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 
sizeof(cdr->
linkedid), 0, cdr->
linkedid, 0, 
NULL);
 
  150        SQLBindParameter(stmt, i + 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->
sequence, 0, 
NULL);
 
  155    if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
 
  156        ast_log(
LOG_WARNING, 
"cdr_odbc: Error in ExecDirect: %d, query is: %s\n", ODBC_res, sqlcmd);
 
  157        SQLFreeHandle(SQL_HANDLE_STMT, stmt);