提交 1e6200b5 authored 作者: Michael Jerris's avatar Michael Jerris

FS-5074: --resolve support sqlite:// for DSNs

上级 70a95603
...@@ -341,6 +341,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_ ...@@ -341,6 +341,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
if (!strncasecmp(dsn, "pgsql://", 8)) { if (!strncasecmp(dsn, "pgsql://", 8)) {
type = SCDB_TYPE_PGSQL; type = SCDB_TYPE_PGSQL;
connection_options.pgsql_options.dsn = (char *)(dsn + 8); connection_options.pgsql_options.dsn = (char *)(dsn + 8);
} else if (!strncasecmp(dsn, "sqlite://", 9)) {
type = SCDB_TYPE_CORE_DB;
connection_options.core_db_options.db_path = (char *)(dsn + 9);
} else if ((!(i = strncasecmp(dsn, "odbc://", 7))) || strchr(dsn, ':')) { } else if ((!(i = strncasecmp(dsn, "odbc://", 7))) || strchr(dsn, ':')) {
type = SCDB_TYPE_ODBC; type = SCDB_TYPE_ODBC;
...@@ -360,14 +363,8 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_ ...@@ -360,14 +363,8 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
*p++ = '\0'; *p++ = '\0';
connection_options.odbc_options.pass = p; connection_options.odbc_options.pass = p;
} }
} }
} else { } else {
if (!strncasecmp(dsn, "sqlite://", 9)) {
dsn += 9;
}
type = SCDB_TYPE_CORE_DB; type = SCDB_TYPE_CORE_DB;
connection_options.core_db_options.db_path = (char *)dsn; connection_options.core_db_options.db_path = (char *)dsn;
} }
...@@ -377,7 +374,6 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_ ...@@ -377,7 +374,6 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
if (status != SWITCH_STATUS_SUCCESS) *dbh = NULL; if (status != SWITCH_STATUS_SUCCESS) *dbh = NULL;
return status; return status;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论