diff options
-rw-r--r-- | libdbpp/Jamfile.jam | 8 | ||||
-rw-r--r-- | libdbpp/connection.cpp | 2 | ||||
-rw-r--r-- | libdbpp/connection.h | 4 | ||||
-rw-r--r-- | libdbpp/createMockDb.cpp | 5 | ||||
-rw-r--r-- | libdbpp/mockDatabase.cpp | 6 | ||||
-rw-r--r-- | libdbpp/mockDatabase.h | 10 | ||||
-rw-r--r-- | libdbpp/sqlParse.h | 8 | ||||
-rw-r--r-- | libdbpp/sqlParseImpl.cpp | 4 | ||||
-rw-r--r-- | libdbpp/unittests/Jamfile.jam | 14 | ||||
m--------- | libdbpp/unittests/libdbpp-postgresql | 0 | ||||
-rw-r--r-- | libdbpp/unittests/mockdb.cpp | 2 | ||||
-rw-r--r-- | libdbpp/unittests/mockdb.h | 2 | ||||
-rw-r--r-- | libdbpp/unittests/testParse.cpp | 4 |
13 files changed, 41 insertions, 28 deletions
diff --git a/libdbpp/Jamfile.jam b/libdbpp/Jamfile.jam index 4ea9c44..b2fc69f 100644 --- a/libdbpp/Jamfile.jam +++ b/libdbpp/Jamfile.jam @@ -2,7 +2,7 @@ import package ; import lex ; lib boost_date_time : : <name>boost_date_time ; -lib boost_filesystem ; +lib stdc++fs lib boost_system ; lib pthread ; lib boost_program_options ; @@ -15,14 +15,14 @@ lib dbppcore : <library>adhocutil <library>boost_system <library>pthread - <library>boost_filesystem + <library>stdc++fs <include>. : : <include>. <library>..//glibmm <library>boost_date_time <library>boost_system - <library>boost_filesystem + <library>stdc++fs ; lib dbpptestcore : @@ -39,7 +39,7 @@ exe createmockdb : createMockDb.cpp : : <library>dbppcore - <library>boost_filesystem + <library>stdc++fs <library>boost_system <library>boost_program_options ; diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp index a7092e5..69e1e92 100644 --- a/libdbpp/connection.cpp +++ b/libdbpp/connection.cpp @@ -92,7 +92,7 @@ DB::Connection::inTx() const } void -DB::Connection::executeScript(std::istream & f, const boost::filesystem::path & s) +DB::Connection::executeScript(std::istream & f, const std::filesystem::path & s) { DB::SqlExecuteScript p(f, s, this); p.Execute(); diff --git a/libdbpp/connection.h b/libdbpp/connection.h index 00d963a..2d4bc9b 100644 --- a/libdbpp/connection.h +++ b/libdbpp/connection.h @@ -7,7 +7,7 @@ #include <factory.h> #include <exception.h> #include <visibility.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <memory> #include <optional> #include "error.h" @@ -121,7 +121,7 @@ namespace DB { /// Execute a script from a stream. /// @param f the script. /// @param s the location of the script. - virtual void executeScript(std::istream & f, const boost::filesystem::path & s); + virtual void executeScript(std::istream & f, const std::filesystem::path & s); /// Create a new select command with the given SQL. virtual SelectCommandPtr select(const std::string & sql, const CommandOptionsCPtr & = nullptr) = 0; /// Create a new modify command with the given SQL. diff --git a/libdbpp/createMockDb.cpp b/libdbpp/createMockDb.cpp index 006e30e..a4d5638 100644 --- a/libdbpp/createMockDb.cpp +++ b/libdbpp/createMockDb.cpp @@ -1,12 +1,11 @@ #include <iostream> #include <boost/program_options.hpp> -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> #include <signal.h> #include "mockDatabase.h" namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; void emptyHandler(int) { } diff --git a/libdbpp/mockDatabase.cpp b/libdbpp/mockDatabase.cpp index 80d4732..35fa748 100644 --- a/libdbpp/mockDatabase.cpp +++ b/libdbpp/mockDatabase.cpp @@ -8,7 +8,7 @@ #include <factory.impl.h> INSTANTIATEPLUGINOF(DB::MockDatabase); -INSTANTIATEFACTORY(DB::MockDatabase, const std::string &, const std::string &, const std::vector<boost::filesystem::path> &); +INSTANTIATEFACTORY(DB::MockDatabase, const std::string &, const std::string &, const std::vector<std::filesystem::path> &); PLUGINRESOLVER(DB::MockDatabaseFactory, DB::Connection::resolvePlugin); namespace DB { @@ -23,7 +23,7 @@ MockDatabase::openConnectionTo(const std::string & mockName) } void -MockDatabase::PlaySchemaScripts(const std::vector<boost::filesystem::path> & ss) const +MockDatabase::PlaySchemaScripts(const std::vector<std::filesystem::path> & ss) const { auto conn = ConnectionPtr(openConnection()); try { @@ -43,7 +43,7 @@ MockDatabase::PlaySchemaScripts(const std::vector<boost::filesystem::path> & ss) } void -MockDatabase::PlaySchemaScript(DB::Connection * conn, const boost::filesystem::path & s) const +MockDatabase::PlaySchemaScript(DB::Connection * conn, const std::filesystem::path & s) const { std::ifstream f; f.open(s.string()); diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h index 8a2c2cf..11a1bbd 100644 --- a/libdbpp/mockDatabase.h +++ b/libdbpp/mockDatabase.h @@ -3,7 +3,7 @@ #include <string> #include <vector> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include "connection.h" #include <visibility.h> @@ -25,9 +25,9 @@ class DLL_PUBLIC MockDatabase : public AdHoc::AbstractPluginImplementation { /// Implementation specific method to create a new database. virtual void CreateNewDatabase() const = 0; /// Execute ordered collection of scripts to setup mock database. e.g. schema.sql, sampleData.sql - virtual void PlaySchemaScripts(const std::vector<boost::filesystem::path> & ss) const; + virtual void PlaySchemaScripts(const std::vector<std::filesystem::path> & ss) const; /// Execute a single setup script. - virtual void PlaySchemaScript(DB::Connection *, const boost::filesystem::path & s) const; + virtual void PlaySchemaScript(DB::Connection *, const std::filesystem::path & s) const; /// Implementation specific method to drop a database. virtual void DropDatabase() const = 0; @@ -68,7 +68,7 @@ class PluginMock { /// @param s the collection of scripts to populate the mock database. /// @param args arguments to the mock database constructor. template<typename ... Args> - PluginMock(const std::string & name, const std::initializer_list<boost::filesystem::path> & s, const Args & ... args) : + PluginMock(const std::string & name, const std::initializer_list<std::filesystem::path> & s, const Args & ... args) : mockName(name) { AdHoc::PluginManager::getDefault()->create<MockDatabase, T>(mockName, __FILE__, __LINE__, args..., name, s); @@ -87,7 +87,7 @@ class PluginMock { const std::string mockName; }; -typedef AdHoc::Factory<MockDatabase, const std::string &, const std::string &, const std::vector<boost::filesystem::path> &> MockDatabaseFactory; +typedef AdHoc::Factory<MockDatabase, const std::string &, const std::string &, const std::vector<std::filesystem::path> &> MockDatabaseFactory; } #endif diff --git a/libdbpp/sqlParse.h b/libdbpp/sqlParse.h index 5ab5143..fc6b4c9 100644 --- a/libdbpp/sqlParse.h +++ b/libdbpp/sqlParse.h @@ -5,7 +5,7 @@ #include <string> #include <exception.h> #include "connection.h" -#include <boost/filesystem/path.hpp> +#include <filesystem> #ifndef yyFlexLexer #define yyFlexLexer sqlBaseFlexLexer #include <FlexLexer.h> @@ -29,7 +29,7 @@ namespace DB { /// @cond class DLL_PUBLIC SqlParse : public yyFlexLexer { public: - SqlParse(std::istream &, const boost::filesystem::path &); + SqlParse(std::istream &, const std::filesystem::path &); void Execute(); @@ -41,14 +41,14 @@ namespace DB { private: int yylex() override; - const boost::filesystem::path scriptDir; + const std::filesystem::path scriptDir; std::string comment; std::string statement; }; class DLL_PUBLIC SqlExecuteScript : public SqlParse { public: - SqlExecuteScript(std::istream &, const boost::filesystem::path &, Connection *); + SqlExecuteScript(std::istream &, const std::filesystem::path &, Connection *); void Comment(const std::string &) const override; void Statement(const std::string &) const override; diff --git a/libdbpp/sqlParseImpl.cpp b/libdbpp/sqlParseImpl.cpp index 57c4248..a187ba7 100644 --- a/libdbpp/sqlParseImpl.cpp +++ b/libdbpp/sqlParseImpl.cpp @@ -12,7 +12,7 @@ namespace DB { return SqlParseExceptionMsg::get(reason, line); } - SqlParse::SqlParse(std::istream & f, const boost::filesystem::path & s) : + SqlParse::SqlParse(std::istream & f, const std::filesystem::path & s) : yyFlexLexer(&f, NULL), scriptDir(s) { @@ -33,7 +33,7 @@ namespace DB { throw std::runtime_error(msg); } - SqlExecuteScript::SqlExecuteScript(std::istream & f, const boost::filesystem::path & s, DB::Connection * c) : + SqlExecuteScript::SqlExecuteScript(std::istream & f, const std::filesystem::path & s, DB::Connection * c) : SqlParse(f, s), conn(c) { diff --git a/libdbpp/unittests/Jamfile.jam b/libdbpp/unittests/Jamfile.jam index b1413ba..d80f623 100644 --- a/libdbpp/unittests/Jamfile.jam +++ b/libdbpp/unittests/Jamfile.jam @@ -125,3 +125,17 @@ run testMock ; +run + libdbpp-postgresql/libpqpp/unittests/testpq.cpp + : : + libdbpp-postgresql/libpqpp/unittests/pqschema.sql + : + <define>ROOT=\"$(me)/libdbpp-postgresql/libpqpp/unittests\" + <define>BOOST_TEST_DYN_LINK + <library>dbpp-local-postgresql + <library>..//dbpptestcore + <library>..//adhocutil + <library>boost_utf + <library>..//stdc++fs + <library>boost_system + ; diff --git a/libdbpp/unittests/libdbpp-postgresql b/libdbpp/unittests/libdbpp-postgresql -Subproject a4c6328efab2e614a46b4a1c78fb0c5678c3fd7 +Subproject b7544cf990e782cec92a69555ab9dacd3f2d596 diff --git a/libdbpp/unittests/mockdb.cpp b/libdbpp/unittests/mockdb.cpp index d831b57..ea85294 100644 --- a/libdbpp/unittests/mockdb.cpp +++ b/libdbpp/unittests/mockdb.cpp @@ -58,7 +58,7 @@ MockDb::modify(const std::string &, const DB::CommandOptionsCPtr &) return nullptr; } -MockMock::MockMock(const std::string &, const std::string &, const std::vector<boost::filesystem::path> & ss) : +MockMock::MockMock(const std::string &, const std::string &, const std::vector<std::filesystem::path> & ss) : DB::MockDatabase() { CreateNewDatabase(); diff --git a/libdbpp/unittests/mockdb.h b/libdbpp/unittests/mockdb.h index 41d63e1..379d076 100644 --- a/libdbpp/unittests/mockdb.h +++ b/libdbpp/unittests/mockdb.h @@ -24,7 +24,7 @@ class MockDb : public DB::Connection { class MockMock : public DB::MockDatabase { public: - MockMock(const std::string &, const std::string &, const std::vector<boost::filesystem::path> &); + MockMock(const std::string &, const std::string &, const std::vector<std::filesystem::path> &); DB::ConnectionPtr openConnection() const override; void CreateNewDatabase() const override; void DropDatabase() const override; diff --git a/libdbpp/unittests/testParse.cpp b/libdbpp/unittests/testParse.cpp index b5f3d65..491e8e6 100644 --- a/libdbpp/unittests/testParse.cpp +++ b/libdbpp/unittests/testParse.cpp @@ -14,7 +14,7 @@ BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(SQLs); class RecordingParser : std::fstream, public DB::SqlParse { public: - RecordingParser(const boost::filesystem::path & p) : + RecordingParser(const std::filesystem::path & p) : std::fstream(p.string()), DB::SqlParse(*this, p.parent_path()) { @@ -35,7 +35,7 @@ class RecordingParser : std::fstream, public DB::SqlParse { }; template<typename E = DB::SqlParseException> -void assertFail(const boost::filesystem::path & p) +void assertFail(const std::filesystem::path & p) { BOOST_TEST_CONTEXT(p) { BOOST_REQUIRE_THROW({ |