summaryrefslogtreecommitdiff
path: root/src/database/postgresql_engine.hpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-10-04 21:28:18 +0200
committerlouiz’ <louiz@louiz.org>2017-12-02 20:08:47 +0100
commit0168b96b79db2627fdba77a8712956408aa081d1 (patch)
tree5591527ed8a04be8ea04c49521d9e9c868677bd1 /src/database/postgresql_engine.hpp
parent5b27cee97272d4ae6ff30f03dc57221fa3e3183f (diff)
downloadbiboumi-0168b96b79db2627fdba77a8712956408aa081d1.tar.gz
biboumi-0168b96b79db2627fdba77a8712956408aa081d1.tar.bz2
biboumi-0168b96b79db2627fdba77a8712956408aa081d1.tar.xz
biboumi-0168b96b79db2627fdba77a8712956408aa081d1.zip
Add postgresql support
Diffstat (limited to 'src/database/postgresql_engine.hpp')
-rw-r--r--src/database/postgresql_engine.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/database/postgresql_engine.hpp b/src/database/postgresql_engine.hpp
new file mode 100644
index 0000000..e6444d4
--- /dev/null
+++ b/src/database/postgresql_engine.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <database/engine.hpp>
+
+#include <database/statement.hpp>
+
+#include <libpq-fe.h>
+
+#include <memory>
+#include <string>
+#include <tuple>
+#include <set>
+
+class PostgresqlEngine: public DatabaseEngine
+{
+ public:
+ PostgresqlEngine(PGconn*const conn);
+
+ ~PostgresqlEngine();
+
+ static std::unique_ptr<DatabaseEngine> open(const std::string& string);
+
+ std::set<std::string> get_all_columns_from_table(const std::string& table_name) override final;
+ std::tuple<bool, std::string> raw_exec(const std::string& query) override final;
+ std::unique_ptr<Statement> prepare(const std::string& query) override;
+ void extract_last_insert_rowid(Statement& statement) override;
+ std::string get_returning_id_sql_string(const std::string& col_name) override;
+ std::string id_column_type() override;
+private:
+ PGconn* const conn;
+};