Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d25bde06
提交
d25bde06
authored
11月 09, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4816 --resolve
上级
db20df23
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
69 行增加
和
4 行删除
+69
-4
switch_core_sqldb.c
src/switch_core_sqldb.c
+69
-4
没有找到文件。
src/switch_core_sqldb.c
浏览文件 @
d25bde06
...
...
@@ -2957,6 +2957,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
case
SCDB_TYPE_ODBC
:
{
char
*
err
;
int
result
=
0
;
switch_cache_db_test_reactive
(
sql_manager
.
dbh
,
"select call_uuid, read_bit_rate, sent_callee_name from channels"
,
"DROP TABLE channels"
,
create_channels_sql
);
switch_cache_db_test_reactive
(
sql_manager
.
dbh
,
"select * from detailed_calls where sent_callee_name=''"
,
"DROP VIEW detailed_calls"
,
detailed_calls_sql
);
switch_cache_db_test_reactive
(
sql_manager
.
dbh
,
"select * from basic_calls where sent_callee_name=''"
,
"DROP VIEW basic_calls"
,
basic_calls_sql
);
...
...
@@ -2973,12 +2975,72 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch_cache_db_test_reactive
(
sql_manager
.
dbh
,
"select ikey from interfaces"
,
"DROP TABLE interfaces"
,
create_interfaces_sql
);
switch_cache_db_test_reactive
(
sql_manager
.
dbh
,
"select hostname from tasks"
,
"DROP TABLE tasks"
,
create_tasks_sql
);
if
(
runtime
.
odbc_dbtype
==
DBTYPE_DEFAULT
)
{
switch_cache_db_execute_sql
(
sql_manager
.
dbh
,
"begin;delete from channels where hostname='';delete from channels where hostname='';commit;"
,
&
err
);
}
else
{
switch_cache_db_execute_sql
(
sql_manager
.
dbh
,
"delete from channels where hostname='';delete from channels where hostname='';"
,
&
err
);
switch
(
sql_manager
.
dbh
->
type
)
{
case
SCDB_TYPE_CORE_DB
:
{
switch_cache_db_execute_sql_real
(
sql_manager
.
dbh
,
"BEGIN"
,
&
err
);
}
break
;
case
SCDB_TYPE_ODBC
:
{
switch_odbc_status_t
result
;
if
((
result
=
switch_odbc_SQLSetAutoCommitAttr
(
sql_manager
.
dbh
->
native_handle
.
odbc_dbh
,
0
))
!=
SWITCH_ODBC_SUCCESS
)
{
char
tmp
[
100
];
switch_snprintfv
(
tmp
,
sizeof
(
tmp
),
"%q-%i"
,
"Unable to Set AutoCommit Off"
,
result
);
err
=
strdup
(
tmp
);
}
}
break
;
case
SCDB_TYPE_PGSQL
:
{
switch_pgsql_status_t
result
;
if
((
result
=
switch_pgsql_SQLSetAutoCommitAttr
(
sql_manager
.
dbh
->
native_handle
.
pgsql_dbh
,
0
))
!=
SWITCH_PGSQL_SUCCESS
)
{
char
tmp
[
100
];
switch_snprintfv
(
tmp
,
sizeof
(
tmp
),
"%q-%i"
,
"Unable to Set AutoCommit Off"
,
result
);
err
=
strdup
(
tmp
);
}
}
break
;
}
switch_cache_db_execute_sql
(
sql_manager
.
dbh
,
"delete from channels where hostname=''"
,
&
err
);
if
(
!
err
)
{
switch_cache_db_execute_sql
(
sql_manager
.
dbh
,
"delete from channels where hostname=''"
,
&
err
);
switch
(
sql_manager
.
dbh
->
type
)
{
case
SCDB_TYPE_CORE_DB
:
{
switch_cache_db_execute_sql_real
(
sql_manager
.
dbh
,
"COMMIT"
,
&
err
);
}
break
;
case
SCDB_TYPE_ODBC
:
{
if
(
switch_odbc_SQLEndTran
(
sql_manager
.
dbh
->
native_handle
.
odbc_dbh
,
1
)
!=
SWITCH_ODBC_SUCCESS
||
switch_odbc_SQLSetAutoCommitAttr
(
sql_manager
.
dbh
->
native_handle
.
odbc_dbh
,
1
)
!=
SWITCH_ODBC_SUCCESS
)
{
char
tmp
[
100
];
switch_snprintfv
(
tmp
,
sizeof
(
tmp
),
"%q-%i"
,
"Unable to commit transaction."
,
result
);
err
=
strdup
(
tmp
);
}
}
break
;
case
SCDB_TYPE_PGSQL
:
{
if
(
switch_pgsql_SQLEndTran
(
sql_manager
.
dbh
->
native_handle
.
pgsql_dbh
,
1
)
!=
SWITCH_PGSQL_SUCCESS
||
switch_pgsql_SQLSetAutoCommitAttr
(
sql_manager
.
dbh
->
native_handle
.
pgsql_dbh
,
1
)
!=
SWITCH_PGSQL_SUCCESS
||
switch_pgsql_finish_results
(
sql_manager
.
dbh
->
native_handle
.
pgsql_dbh
)
!=
SWITCH_PGSQL_SUCCESS
)
{
char
tmp
[
100
];
switch_snprintfv
(
tmp
,
sizeof
(
tmp
),
"%q-%i"
,
"Unable to commit transaction."
,
result
);
err
=
strdup
(
tmp
);
}
}
break
;
}
}
if
(
err
)
{
runtime
.
odbc_dsn
=
NULL
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Transactions not supported on your DB, disabling non-SQLite support; using SQLite
\n
"
);
...
...
@@ -3069,6 +3131,9 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch_thread_create
(
&
sql_manager
.
db_thread
,
thd_attr
,
switch_core_sql_db_thread
,
NULL
,
sql_manager
.
memory_pool
);
}
switch_cache_db_release_db_handle
(
&
sql_manager
.
dbh
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论