summaryrefslogtreecommitdiff
path: root/src/database/postgresql_engine.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/postgresql_engine.hpp')
-rw-r--r--src/database/postgresql_engine.hpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/database/postgresql_engine.hpp b/src/database/postgresql_engine.hpp
index e6444d4..fe4fb53 100644
--- a/src/database/postgresql_engine.hpp
+++ b/src/database/postgresql_engine.hpp
@@ -1,16 +1,20 @@
#pragma once
-#include <database/engine.hpp>
+#include <biboumi.h>
+#include <string>
+#include <stdexcept>
+#include <memory>
#include <database/statement.hpp>
+#include <database/engine.hpp>
-#include <libpq-fe.h>
-
-#include <memory>
-#include <string>
#include <tuple>
#include <set>
+#ifdef PQ_FOUND
+
+#include <libpq-fe.h>
+
class PostgresqlEngine: public DatabaseEngine
{
public:
@@ -29,3 +33,16 @@ class PostgresqlEngine: public DatabaseEngine
private:
PGconn* const conn;
};
+
+#else
+
+class PostgresqlEngine
+{
+public:
+ static std::unique_ptr<DatabaseEngine> open(const std::string& string)
+ {
+ throw std::runtime_error("Cannot open postgresql database "s + string + ": biboumi is not compiled with libpq.");
+ }
+};
+
+#endif