Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bc6334a6
提交
bc6334a6
authored
6月 07, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FSCORE-617
上级
c9e0a410
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
29 行增加
和
20 行删除
+29
-20
switch_mprintf.h
src/include/switch_mprintf.h
+3
-3
switch_utils.h
src/include/switch_utils.h
+6
-3
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+2
-2
mod_directory.c
src/mod/applications/mod_directory/mod_directory.c
+1
-1
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+1
-1
mod_dingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
+6
-6
mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.c
+1
-1
switch_core_db.c
src/switch_core_db.c
+1
-1
switch_core_sqldb.c
src/switch_core_sqldb.c
+8
-2
没有找到文件。
src/include/switch_mprintf.h
浏览文件 @
bc6334a6
...
...
@@ -22,7 +22,7 @@ SWITCH_BEGIN_EXTERN_C
* options that are useful for constructing SQL statements.
*
* The strings returned by this routine should be freed by calling
*
switch_core_db_
free().
* free().
*
* All of the usual printf formatting options apply. In addition, there
* is a "%q" option. %q works like %s in that it substitutes a null-terminated
...
...
@@ -37,9 +37,9 @@ SWITCH_BEGIN_EXTERN_C
*
* We can use this text in an SQL statement as follows:
*
* char *z = switch_
core_db_
mprintf("INSERT INTO TABLES('%q')", zText);
* char *z = switch_mprintf("INSERT INTO TABLES('%q')", zText);
* switch_core_db_exec(db, z, callback1, 0, 0);
*
switch_core_db_
free(z);
* free(z);
*
* Because the %q format string is used, the '\'' character in zText
* is escaped and the SQL generated is as follows:
...
...
src/include/switch_utils.h
浏览文件 @
bc6334a6
...
...
@@ -653,14 +653,17 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
/* malloc or DIE macros */
#ifdef NDEBUG
#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr )
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), memset(ptr, 0, len))
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
#else
#if (_MSC_VER >= 1500) // VC9+
#define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr);__analysis_assume( ptr )
#define switch_zmalloc(ptr, len) (void)(assert((ptr = malloc(len))),memset(ptr, 0, len));__analysis_assume( ptr )
#define switch_zmalloc(ptr, len) (void)(assert((ptr = calloc(1, (len)))),ptr);__analysis_assume( ptr )
#define switch_strdup(ptr, s) (void)(assert(((ptr) = _strdup(s)((len)))),ptr);__analysis_assume( ptr )
#else
#define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr)
#define switch_zmalloc(ptr, len) (void)(assert((ptr = malloc(len))),memset(ptr, 0, len))
#define switch_zmalloc(ptr, len) (void)(assert((ptr = calloc(1, (len)))),ptr)
#define switch_strdup(ptr, s) (void)(assert(((ptr) = strdup((s)))),ptr)
#endif
#endif
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
bc6334a6
...
...
@@ -3500,7 +3500,7 @@ SWITCH_STANDARD_API(show_function)
if
(
errmsg
)
{
stream
->
write_function
(
stream
,
"-ERR SQL Error [%s]
\n
"
,
errmsg
);
switch_core_db_
free
(
errmsg
);
free
(
errmsg
);
errmsg
=
NULL
;
}
else
if
(
help
)
{
if
(
holder
.
count
==
0
)
...
...
@@ -3513,7 +3513,7 @@ SWITCH_STANDARD_API(show_function)
if
(
errmsg
)
{
stream
->
write_function
(
stream
,
"-ERR SQL Error [%s]
\n
"
,
errmsg
);
switch_core_db_
free
(
errmsg
);
free
(
errmsg
);
errmsg
=
NULL
;
}
...
...
src/mod/applications/mod_directory/mod_directory.c
浏览文件 @
bc6334a6
...
...
@@ -295,7 +295,7 @@ static switch_bool_t directory_execute_sql_callback(switch_mutex_t *mutex, char
if
(
errmsg
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s] %s
\n
"
,
sql
,
errmsg
);
free
(
errmsg
);
switch_core_db_
free
(
errmsg
);
}
if
(
db
)
{
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
bc6334a6
...
...
@@ -379,7 +379,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
switch_cache_db_release_db_handle
(
&
db
);
if
(
errmsg
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Error: %s
\n
"
,
errmsg
);
switch_core_db_
free
(
errmsg
);
free
(
errmsg
);
if
((
file
=
switch_channel_get_variable
(
channel
,
"eavesdrop_indicate_failed"
)))
{
switch_ivr_play_file
(
session
,
NULL
,
file
,
NULL
);
}
...
...
src/mod/endpoints/mod_dingaling/mod_dingaling.c
浏览文件 @
bc6334a6
...
...
@@ -317,7 +317,7 @@ static switch_bool_t mdl_execute_sql_callback(mdl_profile_t *profile,
if
(
errmsg
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s] %s
\n
"
,
sql
,
errmsg
);
free
(
errmsg
);
switch_core_db_
free
(
errmsg
);
}
if
(
db
)
{
...
...
@@ -2730,7 +2730,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
if
((
sql
=
switch_mprintf
(
"delete from jabber_subscriptions where sub_from='%q' and sub_to='%q';"
,
from
,
to
)))
{
mdl_execute_sql
(
profile
,
sql
,
profile
->
mutex
);
switch_core_db_
free
(
sql
);
free
(
sql
);
}
break
;
...
...
@@ -2743,12 +2743,12 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
switch_mutex_lock
(
profile
->
mutex
);
if
((
sql
=
switch_mprintf
(
"delete from jabber_subscriptions where sub_from='%q' and sub_to='%q'"
,
from
,
to
)))
{
mdl_execute_sql
(
profile
,
sql
,
NULL
);
switch_core_db_
free
(
sql
);
free
(
sql
);
}
if
((
sql
=
switch_mprintf
(
"insert into jabber_subscriptions values('%q','%q','%q','%q');
\n
"
,
switch_str_nil
(
from
),
switch_str_nil
(
to
),
switch_str_nil
(
msg
),
switch_str_nil
(
subject
))))
{
mdl_execute_sql
(
profile
,
sql
,
NULL
);
switch_core_db_
free
(
sql
);
free
(
sql
);
}
switch_mutex_unlock
(
profile
->
mutex
);
if
(
is_special
(
to
))
{
...
...
@@ -2796,7 +2796,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
if
((
sql
=
switch_mprintf
(
"update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'"
,
switch_str_nil
(
msg
),
switch_str_nil
(
subject
),
switch_str_nil
(
from
))))
{
mdl_execute_sql
(
profile
,
sql
,
profile
->
mutex
);
switch_core_db_
free
(
sql
);
free
(
sql
);
}
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_PRESENCE_IN
)
==
SWITCH_STATUS_SUCCESS
)
{
...
...
@@ -2831,7 +2831,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
if
((
sql
=
switch_mprintf
(
"update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'"
,
switch_str_nil
(
msg
),
switch_str_nil
(
subject
),
switch_str_nil
(
from
))))
{
mdl_execute_sql
(
profile
,
sql
,
profile
->
mutex
);
switch_core_db_
free
(
sql
);
free
(
sql
);
}
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_PRESENCE_OUT
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"proto"
,
MDL_CHAT_PROTO
);
...
...
src/mod/endpoints/mod_skinny/mod_skinny.c
浏览文件 @
bc6334a6
...
...
@@ -329,7 +329,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
if
(
errmsg
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s] %s
\n
"
,
sql
,
errmsg
);
free
(
errmsg
);
switch_core_db_
free
(
errmsg
);
}
if
(
db
)
{
...
...
src/switch_core_db.c
浏览文件 @
bc6334a6
...
...
@@ -93,7 +93,7 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s
ret
=
sqlite3_exec
(
db
,
sql
,
callback
,
data
,
&
err
);
if
(
ret
==
SQLITE_BUSY
||
ret
==
SQLITE_LOCKED
)
{
if
(
sane
>
1
)
{
switch_
safe
_free
(
err
);
switch_
core_db
_free
(
err
);
switch_yield
(
100000
);
continue
;
}
...
...
src/switch_core_sqldb.c
浏览文件 @
bc6334a6
...
...
@@ -374,6 +374,7 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t
{
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
char
*
errmsg
=
NULL
;
char
*
tmp
=
NULL
;
if
(
dbh
->
io_mutex
)
{
switch_mutex_lock
(
dbh
->
io_mutex
);
...
...
@@ -395,6 +396,11 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t
case
SCDB_TYPE_CORE_DB
:
{
status
=
switch_core_db_exec
(
dbh
->
native_handle
.
core_db_dbh
,
sql
,
NULL
,
NULL
,
&
errmsg
);
if
(
errmsg
)
{
switch_strdup
(
tmp
,
errmsg
);
switch_core_db_free
(
errmsg
);
errmsg
=
tmp
;
}
}
break
;
}
...
...
@@ -721,7 +727,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach
if
(
errmsg
)
{
dbh
->
last_used
=
switch_epoch_time_now
(
NULL
)
-
(
SQL_CACHE_TIMEOUT
*
2
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SQL ERR: [%s] %s
\n
"
,
sql
,
errmsg
);
free
(
errmsg
);
switch_core_db_
free
(
errmsg
);
}
}
break
;
...
...
@@ -874,7 +880,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
len
+=
newlen
;
}
switch_core_db_
free
(
sql
);
free
(
sql
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"SQL thread ending
\n
"
);
break
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论