mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Merge bkw_'s ODBC patch
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3395 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -59,12 +59,8 @@ static int odbc_log(struct ast_cdr *cdr)
|
|||||||
char sqlcmd[2048], timestr[128];
|
char sqlcmd[2048], timestr[128];
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
struct timeval tv;
|
|
||||||
time_t t;
|
|
||||||
|
|
||||||
gettimeofday(&tv,NULL);
|
localtime_r(&cdr->start.tv_sec,&tm);
|
||||||
t = tv.tv_sec;
|
|
||||||
localtime_r(&t,&tm);
|
|
||||||
|
|
||||||
ast_mutex_lock(&odbc_lock);
|
ast_mutex_lock(&odbc_lock);
|
||||||
strftime(timestr,128,DATE_FORMAT,&tm);
|
strftime(timestr,128,DATE_FORMAT,&tm);
|
||||||
|
@@ -111,7 +111,7 @@ static struct ast_config *config_odbc(char *file, struct ast_config *new_config_
|
|||||||
SQLBindCol(stmt,7,SQL_C_CHAR,&var_name,sizeof(var_name),&err);
|
SQLBindCol(stmt,7,SQL_C_CHAR,&var_name,sizeof(var_name),&err);
|
||||||
SQLBindCol(stmt,8,SQL_C_CHAR,&var_val,sizeof(var_val),&err);
|
SQLBindCol(stmt,8,SQL_C_CHAR,&var_val,sizeof(var_val),&err);
|
||||||
|
|
||||||
sprintf(sql,"select * from %s where filename='%s' and commented=0 order by filename,cat_metric,var_metric,id",table,file);
|
sprintf(sql,"select * from %s where filename='%s' and commented=0 order by filename,cat_metric desc,var_metric asc,id",table,file);
|
||||||
res = SQLExecDirect(stmt,sql,SQL_NTS);
|
res = SQLExecDirect(stmt,sql,SQL_NTS);
|
||||||
|
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
Reference in New Issue
Block a user