summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-12-16 15:34:54 +0100
committerlouiz’ <louiz@louiz.org>2017-12-16 15:34:54 +0100
commita557718bf2f16c440313e5d5409b23dcefa45ab9 (patch)
treea5022b2b1c1f7269cf9ab628d8bb2178504e9653 /src
parent53fc926dc847af55a13a6ac9ea852658b0b0ba4d (diff)
downloadbiboumi-a557718bf2f16c440313e5d5409b23dcefa45ab9.tar.gz
biboumi-a557718bf2f16c440313e5d5409b23dcefa45ab9.tar.bz2
biboumi-a557718bf2f16c440313e5d5409b23dcefa45ab9.tar.xz
biboumi-a557718bf2f16c440313e5d5409b23dcefa45ab9.zip
db_name also accepts postgres:// scheme for PostgreSQL connections
Diffstat (limited to 'src')
-rw-r--r--src/database/database.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp
index ae5654c..3622963 100644
--- a/src/database/database.cpp
+++ b/src/database/database.cpp
@@ -34,7 +34,9 @@ void Database::open(const std::string& filename)
// not, just leave things untouched
std::unique_ptr<DatabaseEngine> new_db;
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);
else
new_db = Sqlite3Engine::open(filename);