Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d1a9b377
提交
d1a9b377
authored
1月 26, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3794 try this please
上级
7788f3e9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
128 行增加
和
59 行删除
+128
-59
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+14
-3
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+94
-49
switch_odbc.c
src/switch_odbc.c
+20
-7
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
d1a9b377
...
...
@@ -6266,6 +6266,7 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
void
sofia_glue_actually_execute_sql
(
sofia_profile_t
*
profile
,
char
*
sql
,
switch_mutex_t
*
mutex
)
{
switch_cache_db_handle_t
*
dbh
=
NULL
;
char
*
err
=
NULL
;
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
...
...
@@ -6276,7 +6277,12 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
goto
end
;
}
switch_cache_db_execute_sql
(
dbh
,
sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
sql
,
&
err
);
if
(
err
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s]
\n
%s
\n
"
,
err
,
sql
);
free
(
err
);
}
end:
...
...
@@ -6324,7 +6330,7 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
char
*
sofia_glue_execute_sql2str
(
sofia_profile_t
*
profile
,
switch_mutex_t
*
mutex
,
char
*
sql
,
char
*
resbuf
,
size_t
len
)
{
char
*
ret
=
NULL
;
char
*
err
=
NULL
;
switch_cache_db_handle_t
*
dbh
=
NULL
;
if
(
!
(
dbh
=
sofia_glue_get_db_handle
(
profile
)))
{
...
...
@@ -6336,7 +6342,12 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
switch_mutex_lock
(
mutex
);
}
ret
=
switch_cache_db_execute_sql2str
(
dbh
,
sql
,
resbuf
,
len
,
NULL
);
ret
=
switch_cache_db_execute_sql2str
(
dbh
,
sql
,
resbuf
,
len
,
&
err
);
if
(
err
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s]
\n
%s
\n
"
,
err
,
sql
);
free
(
err
);
}
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
d1a9b377
差异被折叠。
点击展开。
src/switch_odbc.c
浏览文件 @
d1a9b377
...
...
@@ -480,10 +480,15 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_
error
:
if
(
stmt
)
{
err_str
=
switch_odbc_handle_get_error
(
handle
,
stmt
);
}
if
(
zstr
(
err_str
))
{
err_str
=
strdup
((
char
*
)
"SQL ERROR!"
);
}
if
(
err_str
)
{
if
(
!
switch_stristr
(
"already exists"
,
err_str
)
&&
!
switch_stristr
(
"duplicate key name"
,
err_str
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"ERR: [%s]
\n
[%s]
\n
"
,
sql
,
switch_str_nil
(
err_str
));
...
...
@@ -513,7 +518,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
SQLHSTMT
stmt
=
NULL
;
SQLSMALLINT
c
=
0
,
x
=
0
;
SQLLEN
m
=
0
;
char
*
err_str
=
NULL
;
char
*
x_err
=
NULL
,
*
err_str
=
NULL
;
int
result
;
int
err_cnt
=
0
;
int
done
=
0
;
...
...
@@ -523,22 +528,24 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
switch_assert
(
callback
!=
NULL
);
if
(
!
db_is_up
(
handle
))
{
x_err
=
"DB is not up!"
;
goto
error
;
}
if
(
SQLAllocHandle
(
SQL_HANDLE_STMT
,
handle
->
con
,
&
stmt
)
!=
SQL_SUCCESS
)
{
err_str
=
strdup
(
"Unable to SQL allocate handle."
)
;
x_err
=
"Unable to SQL allocate handle!"
;
goto
error
;
}
if
(
SQLPrepare
(
stmt
,
(
unsigned
char
*
)
sql
,
SQL_NTS
)
!=
SQL_SUCCESS
)
{
err_str
=
strdup
(
"Unable to prepare SQL statement."
)
;
x_err
=
"Unable to prepare SQL statement!"
;
goto
error
;
}
result
=
SQLExecute
(
stmt
);
if
(
result
!=
SQL_SUCCESS
&&
result
!=
SQL_SUCCESS_WITH_INFO
&&
result
!=
SQL_NO_DATA
)
{
x_err
=
"execute error!"
;
goto
error
;
}
...
...
@@ -598,10 +605,8 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
free
(
vals
);
}
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
stmt
=
NULL
;
/* Make sure we don't try to free this handle again */
if
(
!
err_cnt
)
{
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
return
SWITCH_ODBC_SUCCESS
;
}
...
...
@@ -609,7 +614,10 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
if
(
stmt
)
{
err_str
=
switch_odbc_handle_get_error
(
handle
,
stmt
);
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
}
if
(
zstr
(
err_str
)
&&
!
zstr
(
x_err
))
{
err_str
=
strdup
(
x_err
);
}
if
(
err_str
)
{
...
...
@@ -621,6 +629,11 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
}
}
if
(
stmt
)
{
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
}
#endif
return
SWITCH_ODBC_FAIL
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论