added postgres backend

This commit is contained in:
2023-11-25 12:33:51 +01:00
parent c2a96f4cbd
commit 825e530a8d
20 changed files with 547 additions and 65 deletions
+2 -1
View File
@@ -31,5 +31,6 @@ target_link_libraries(tests PRIVATE
Catch2::Catch2WithMain
matador
${CMAKE_DL_LIBS}
${SQLite3_LIBRARIES})
${SQLite3_LIBRARIES}
${PostgreSQL_LIBRARY})
target_include_directories(tests PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>/include)
+1
View File
@@ -1,4 +1,5 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "matador/sql/connection.hpp"
+7 -1
View File
@@ -1,4 +1,5 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <matador/sql/column.hpp>
#include <matador/sql/condition.hpp>
@@ -13,7 +14,12 @@ using namespace matador::sql;
using namespace matador::test;
TEST_CASE("Create table with foreign key relation", "[session]") {
connection_pool<connection> pool("sqlite://sqlite.db", 4);
auto dns = GENERATE(as<std::string>{},
"sqlite://sqlite.db",
"postgres://test:test123@127.0.0.1:5432/matador_test" );
connection_pool<connection> pool(dns, 4);
session s(pool);
auto res = s.create()
+16 -1
View File
@@ -1,8 +1,23 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "matador/sql/connection.hpp"
using namespace matador;
TEST_CASE("Query test", "[query]") {
auto dns = GENERATE(as<std::string>{}, "mssql", "sqlite", "postgres" );
auto dns = GENERATE(as<std::string>{},
"sqlite://sqlite.db",
"postgres://test:test123@127.0.0.1:5432/matador_test" );
sql::connection c(dns);
REQUIRE(!c.is_open());
c.open();
REQUIRE(c.is_open());
c.close();
REQUIRE(!c.is_open());
INFO(dns);
REQUIRE(!dns.empty());