]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5074: --resolve support sqlite:// for DSNs
authorMichael Jerris <mike@jerris.com>
Tue, 5 Feb 2013 20:52:55 +0000 (14:52 -0600)
committerMichael Jerris <mike@jerris.com>
Tue, 5 Feb 2013 20:52:55 +0000 (14:52 -0600)
src/switch_core_sqldb.c

index a4d16a3f155085189cf9886e480c58aac23d8800..df5e840f48f4e3f6b81d669630e9bb2bb629b94f 100644 (file)
@@ -341,6 +341,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
        if (!strncasecmp(dsn, "pgsql://", 8)) {
                type = SCDB_TYPE_PGSQL;
                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, ':')) {
                type = SCDB_TYPE_ODBC;
 
@@ -360,14 +363,8 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
                                *p++ = '\0';
                                connection_options.odbc_options.pass = p;
                        }
-                       
                }
-
        } else {
-               if (!strncasecmp(dsn, "sqlite://", 9)) {
-                       dsn += 9;
-               }
-
                type = SCDB_TYPE_CORE_DB;
                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_
        if (status != SWITCH_STATUS_SUCCESS) *dbh = NULL;
 
        return status;
-
 }