summaryrefslogtreecommitdiff
path: root/libsqlitepp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-24 13:06:07 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-24 13:09:28 +0000
commitab47c39c82abee7f0e0cff981dc352fdc310a6fe (patch)
tree238979d93b5c4c810c130367fcaccdfacf420b9b /libsqlitepp
parentDon't rely on libdbppcore's columns (diff)
downloadlibdbpp-sqlite-ab47c39c82abee7f0e0cff981dc352fdc310a6fe.tar.bz2
libdbpp-sqlite-ab47c39c82abee7f0e0cff981dc352fdc310a6fe.tar.xz
libdbpp-sqlite-ab47c39c82abee7f0e0cff981dc352fdc310a6fe.zip
Bring up-to-date with libdbpp.
Diffstat (limited to 'libsqlitepp')
-rw-r--r--libsqlitepp/Jamfile.jam6
-rw-r--r--libsqlitepp/sqlite-command.cpp7
-rw-r--r--libsqlitepp/sqlite-command.h1
-rw-r--r--libsqlitepp/sqlite-mock.cpp11
-rw-r--r--libsqlitepp/sqlite-mock.h8
-rw-r--r--libsqlitepp/sqlite-selectcommand.cpp4
6 files changed, 20 insertions, 17 deletions
diff --git a/libsqlitepp/Jamfile.jam b/libsqlitepp/Jamfile.jam
index 6d99b4b..b624c3f 100644
--- a/libsqlitepp/Jamfile.jam
+++ b/libsqlitepp/Jamfile.jam
@@ -4,8 +4,7 @@ lib libsqlite : : <name>sqlite3 ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib dbppcore : : : : <include>/usr/include/dbpp ;
lib boost_date_time ;
-lib boost_filesystem ;
-lib boost_system ;
+lib stdc++fs ;
lib dbpp-sqlite :
[ glob *.cpp ] :
@@ -14,8 +13,7 @@ lib dbpp-sqlite :
<library>adhocutil
<library>dbppcore
<library>boost_date_time
- <library>boost_system
- <library>boost_filesystem
+ <library>stdc++fs
: :
<include>.
<library>..//glibmm
diff --git a/libsqlitepp/sqlite-command.cpp b/libsqlitepp/sqlite-command.cpp
index 3d8ac07..adaf41e 100644
--- a/libsqlitepp/sqlite-command.cpp
+++ b/libsqlitepp/sqlite-command.cpp
@@ -76,7 +76,12 @@ SQLite::Command::bindParamF(unsigned int n, float v)
void
SQLite::Command::bindParamS(unsigned int n, const Glib::ustring & s)
{
- if (sqlite3_bind_text(stmt, n + 1, s.c_str(), s.length(), SQLITE_STATIC) != SQLITE_OK) {
+ return bindParamS(n, std::string_view(s.raw()));
+}
+void
+SQLite::Command::bindParamS(unsigned int n, const std::string_view & s)
+{
+ if (sqlite3_bind_text(stmt, n + 1, s.data(), s.length(), SQLITE_STATIC) != SQLITE_OK) {
throw Error(c->db);
}
}
diff --git a/libsqlitepp/sqlite-command.h b/libsqlitepp/sqlite-command.h
index c66d71d..cbc9932 100644
--- a/libsqlitepp/sqlite-command.h
+++ b/libsqlitepp/sqlite-command.h
@@ -24,6 +24,7 @@ namespace SQLite {
void bindParamF(unsigned int, float) override;
void bindParamS(unsigned int, const Glib::ustring&) override;
+ void bindParamS(unsigned int, const std::string_view&) override;
void bindParamT(unsigned int, const boost::posix_time::time_duration &) override;
void bindParamT(unsigned int, const boost::posix_time::ptime &) override;
diff --git a/libsqlitepp/sqlite-mock.cpp b/libsqlitepp/sqlite-mock.cpp
index 7a18b87..510b209 100644
--- a/libsqlitepp/sqlite-mock.cpp
+++ b/libsqlitepp/sqlite-mock.cpp
@@ -1,20 +1,19 @@
#include "sqlite-mock.h"
#include "sqlite-connection.h"
#include <boost/lexical_cast.hpp>
-#include <boost/filesystem/operations.hpp>
NAMEDFACTORY("sqlite", SQLite::Mock, DB::MockDatabaseFactory);
namespace SQLite {
-Mock::Mock(const std::string & root, const std::string & name, const std::vector<boost::filesystem::path> & ss) :
- testDbPath(boost::filesystem::path(root) / name / boost::lexical_cast<std::string>(getpid()) / boost::lexical_cast<std::string>(++DB::MockDatabase::mocked))
+Mock::Mock(const std::string & root, const std::string & name, const std::vector<std::filesystem::path> & ss) :
+ testDbPath(std::filesystem::path(root) / name / boost::lexical_cast<std::string>(getpid()) / boost::lexical_cast<std::string>(++DB::MockDatabase::mocked))
{
CreateNewDatabase();
PlaySchemaScripts(ss);
}
-Mock::Mock(const std::string & name, const std::vector<boost::filesystem::path> & ss) :
+Mock::Mock(const std::string & name, const std::vector<std::filesystem::path> & ss) :
Mock("/tmp/sqliteut", name, ss)
{
}
@@ -32,12 +31,12 @@ Mock::~Mock()
void Mock::DropDatabase() const
{
- boost::filesystem::remove(testDbPath);
+ std::filesystem::remove(testDbPath);
}
void Mock::CreateNewDatabase() const
{
- boost::filesystem::create_directories(testDbPath.parent_path());
+ std::filesystem::create_directories(testDbPath.parent_path());
openConnection(); // Triggers file creation
}
diff --git a/libsqlitepp/sqlite-mock.h b/libsqlitepp/sqlite-mock.h
index 4580778..cc182d4 100644
--- a/libsqlitepp/sqlite-mock.h
+++ b/libsqlitepp/sqlite-mock.h
@@ -2,15 +2,15 @@
#define MOCKSQLITEDATASOURCE_H
#include <mockDatabase.h>
-#include <boost/filesystem/path.hpp>
+#include <filesystem>
#include <visibility.h>
namespace SQLite {
class DLL_PUBLIC Mock : public DB::MockDatabase {
public:
- Mock(const std::string & root, const std::string & name, const std::vector<boost::filesystem::path> & ss);
- Mock(const std::string & name, const std::vector<boost::filesystem::path> & ss);
+ Mock(const std::string & root, const std::string & name, const std::vector<std::filesystem::path> & ss);
+ Mock(const std::string & name, const std::vector<std::filesystem::path> & ss);
~Mock();
protected:
@@ -20,7 +20,7 @@ class DLL_PUBLIC Mock : public DB::MockDatabase {
DB::ConnectionPtr openConnection() const override;
private:
- const boost::filesystem::path testDbPath;
+ const std::filesystem::path testDbPath;
};
}
diff --git a/libsqlitepp/sqlite-selectcommand.cpp b/libsqlitepp/sqlite-selectcommand.cpp
index 67e90ba..909dc5c 100644
--- a/libsqlitepp/sqlite-selectcommand.cpp
+++ b/libsqlitepp/sqlite-selectcommand.cpp
@@ -30,7 +30,7 @@ namespace SQLite {
{
auto t = sqlite3_column_text(stmt, colNo);
auto l = sqlite3_column_bytes(stmt, colNo);
- h.string(reinterpret_cast<const char *>(t), l);
+ h.string({ reinterpret_cast<const char *>(t), (std::size_t)l });
return;
}
case SQLITE_NULL:
@@ -66,7 +66,7 @@ SQLite::SelectCommand::fetch()
case SQLITE_ROW:
if (!columnCount()) {
for (int c = sqlite3_data_count(stmt) - 1; c >= 0; c -= 1) {
- insertColumn(std::make_shared<Column>(sqlite3_column_name(stmt, c), c, stmt));
+ insertColumn(std::make_unique<Column>(sqlite3_column_name(stmt, c), c, stmt));
}
}
return true;