提交 7e23633a authored 作者: Anthony Minessale's avatar Anthony Minessale

stop ken's whining

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5008 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 99be09a6
...@@ -821,6 +821,7 @@ static switch_status_t sched_api_function(char *cmd, switch_core_session_t *ises ...@@ -821,6 +821,7 @@ static switch_status_t sched_api_function(char *cmd, switch_core_session_t *ises
struct holder { struct holder {
switch_stream_handle_t *stream; switch_stream_handle_t *stream;
char *http; char *http;
char *delim;
uint32_t count; uint32_t count;
int print_title; int print_title;
switch_xml_t xml; switch_xml_t xml;
...@@ -876,7 +877,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames) ...@@ -876,7 +877,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
holder->stream->write_function(holder->stream, "<td>"); holder->stream->write_function(holder->stream, "<td>");
holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>"); holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
} else { } else {
holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ","); holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : holder->delim);
} }
} }
} }
...@@ -890,7 +891,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames) ...@@ -890,7 +891,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
holder->stream->write_function(holder->stream, "<td>"); holder->stream->write_function(holder->stream, "<td>");
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "</td></tr>\n" : "</td><td>"); holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
} else { } else {
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : ","); holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : holder->delim);
} }
} }
...@@ -905,7 +906,7 @@ static switch_status_t show_function(char *data, switch_core_session_t *session, ...@@ -905,7 +906,7 @@ static switch_status_t show_function(char *data, switch_core_session_t *session,
switch_core_db_t *db = switch_core_db_handle(); switch_core_db_t *db = switch_core_db_handle();
struct holder holder = { 0 }; struct holder holder = { 0 };
int help = 0; int help = 0;
char *mydata = NULL, *argv[5] = {0}; char *mydata = NULL, *argv[6] = {0};
int argc; int argc;
char *cmd = NULL, *as = NULL; char *cmd = NULL, *as = NULL;
...@@ -969,10 +970,16 @@ static switch_status_t show_function(char *data, switch_core_session_t *session, ...@@ -969,10 +970,16 @@ static switch_status_t show_function(char *data, switch_core_session_t *session,
} }
if (!as) { if (!as) {
as = "csv"; as = "delim";
holder.delim = ",";
} }
if (!strcasecmp(as, "csv")) { if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
if (switch_strlen_zero(holder.delim)) {
if (!(holder.delim = argv[3])) {
holder.delim = ",";
}
}
switch_core_db_exec(db, sql, show_callback, &holder, &errmsg); switch_core_db_exec(db, sql, show_callback, &holder, &errmsg);
if (holder.http) { if (holder.http) {
holder.stream->write_function(holder.stream, "</table>"); holder.stream->write_function(holder.stream, "</table>");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论