提交 2e88c67c authored 作者: Anthony Minessale's avatar Anthony Minessale

improve chunked sql transaction submission

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15672 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 c706e9bb
...@@ -391,23 +391,25 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl ...@@ -391,23 +391,25 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl
p = e; p = e;
} }
while (p > s && *p != ';') { while (p > s) {
p--; if (*p == '\n' && *(p-1) == ';') {
}
if (p) {
*p = '\0'; *p = '\0';
while(p < e && (*p == '\n' || *p == ' ')) { *(p-1) = '\0';
p++; break;
} }
p--;
} }
if (p <= s) break;
status = switch_cache_db_execute_sql_real(dbh, s, err); status = switch_cache_db_execute_sql_real(dbh, s, err);
if (status != SWITCH_STATUS_SUCCESS || (err && *err)) { if (status != SWITCH_STATUS_SUCCESS || (err && *err)) {
break; break;
} }
s = p + 1; s = p;
} }
...@@ -422,14 +424,9 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand ...@@ -422,14 +424,9 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand
switch (dbh->type) { switch (dbh->type) {
case SCDB_TYPE_CORE_DB:
{
status = switch_cache_db_execute_sql_real(dbh, sql, err);
}
break;
default: default:
{ {
status = switch_cache_db_execute_sql_chunked(dbh, (char *)sql, 32000, err); status = switch_cache_db_execute_sql_chunked(dbh, (char *)sql, 32768, err);
} }
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论