src/Connection.h
branchv_0
changeset 27 9441a517fa1f
parent 26 49919a60c747
child 28 498d5d3406c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Connection.h	Wed Dec 25 01:07:41 2019 +0100
@@ -0,0 +1,68 @@
+/**
+ * Relational pipes
+ * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include <memory>
+#include <string>
+#include <sstream>
+#include <regex>
+#include <vector>
+#include <locale>
+#include <codecvt>
+#include <unistd.h>
+#include <cassert>
+#include <sys/stat.h>
+
+#include <sqlite3.h>
+
+#include <relpipe/reader/typedefs.h>
+#include <relpipe/reader/TypeId.h>
+#include <relpipe/reader/handlers/RelationalReaderValueHandler.h>
+#include <relpipe/reader/handlers/AttributeMetadata.h>
+
+#include <relpipe/writer/Factory.h>
+
+#include "Configuration.h"
+#include "SqlException.h"
+#include "PreparedStatement.h"
+
+namespace relpipe {
+namespace tr {
+namespace sql {
+
+using namespace std;
+using namespace relpipe;
+using namespace relpipe::reader;
+using namespace relpipe::reader::handlers;
+
+class Connection {
+private:
+	sqlite3* db;
+	void begin();
+public:
+	Connection(const char* filename);
+	virtual ~Connection();
+	PreparedStatement* prepareStatement(const char* sql);
+	bool getAutoCommit();
+	void setAutoCommit(bool autoCommit);
+	void commit();
+	void rollback();
+};
+
+}
+}
+}