Commit a557718b authored by louiz’'s avatar louiz’

db_name also accepts postgres:// scheme for PostgreSQL connections

parent 53fc926d
...@@ -34,7 +34,9 @@ void Database::open(const std::string& filename) ...@@ -34,7 +34,9 @@ void Database::open(const std::string& filename)
// not, just leave things untouched // not, just leave things untouched
std::unique_ptr<DatabaseEngine> new_db; std::unique_ptr<DatabaseEngine> new_db;
static const auto psql_prefix = "postgresql://"s; static const auto psql_prefix = "postgresql://"s;
if (filename.substr(0, psql_prefix.size()) == psql_prefix) static const auto psql_prefix2 = "postgres://"s;
if ((filename.substr(0, psql_prefix.size()) == psql_prefix) ||
(filename.substr(0, psql_prefix2.size()) == psql_prefix2))
new_db = PostgresqlEngine::open(filename); new_db = PostgresqlEngine::open(filename);
else else
new_db = Sqlite3Engine::open(filename); new_db = Sqlite3Engine::open(filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment