summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-01-21 21:09:14 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-01-21 21:09:14 +0000
commit60178705ae5331cf616ab8e76d7e370aa8c179c6 (patch)
tree4f81903ed27feb93cc00aded5a80e88346e99e9e
parentUpdate to match string_view plugin interface (diff)
downloadlibdbpp-60178705ae5331cf616ab8e76d7e370aa8c179c6.tar.bz2
libdbpp-60178705ae5331cf616ab8e76d7e370aa8c179c6.tar.xz
libdbpp-60178705ae5331cf616ab8e76d7e370aa8c179c6.zip
Update doxygen commentslibdbpp-1.3.0
-rw-r--r--libdbpp/column.cpp4
-rw-r--r--libdbpp/column.h9
-rw-r--r--libdbpp/command.cpp4
-rw-r--r--libdbpp/connection.cpp4
-rw-r--r--libdbpp/connectionPool.h1
-rw-r--r--libdbpp/dbTypes.h1
-rw-r--r--libdbpp/error.h2
-rw-r--r--libdbpp/mockDatabase.h7
-rw-r--r--libdbpp/modifycommand.cpp4
-rw-r--r--libdbpp/selectcommand.cpp7
-rw-r--r--libdbpp/selectcommand.h4
11 files changed, 26 insertions, 21 deletions
diff --git a/libdbpp/column.cpp b/libdbpp/column.cpp
index c630430..a02ba01 100644
--- a/libdbpp/column.cpp
+++ b/libdbpp/column.cpp
@@ -11,9 +11,7 @@ Column::Column(const Glib::ustring & n, unsigned int i) :
{
}
-Column::~Column()
-{
-}
+Column::~Column() = default;
static
std::string
diff --git a/libdbpp/column.h b/libdbpp/column.h
index 8989d17..1c76710 100644
--- a/libdbpp/column.h
+++ b/libdbpp/column.h
@@ -45,9 +45,10 @@ namespace DB {
/// Apply a field handler (any sub-class of HandleField)
virtual void apply(HandleField &) const = 0;
+ /// Column handler dealing with trivial (sensible) type conversions
template<typename T>
class Extract : public DB::HandleField {
- public:
+ private:
template <typename X> struct is_optional {
static constexpr bool value = false;
static constexpr bool is_arithmetic = std::is_arithmetic<X>::value;
@@ -57,6 +58,8 @@ namespace DB {
static constexpr bool is_arithmetic = std::is_arithmetic<X>::value;
};
+ public:
+ /// Create an extrator given a target variable.
Extract(T & t) : target(t) { }
void floatingpoint(double v) override { (*this)(v); }
@@ -76,6 +79,7 @@ namespace DB {
}
}
+ /// Default call operation to [convert and] assign field value to target.
template <typename D>
inline
void operator()(const D & v)
@@ -94,10 +98,11 @@ namespace DB {
throw InvalidConversion(typeid(D).name(), typeid(T).name());
}
+ private:
T & target;
};
- /// STL like string extractor.
+ /// STL like extractor.
template<typename T>
void operator>>(T & v) const
{
diff --git a/libdbpp/command.cpp b/libdbpp/command.cpp
index 2751b54..3c914f8 100644
--- a/libdbpp/command.cpp
+++ b/libdbpp/command.cpp
@@ -11,9 +11,7 @@ DB::Command::Command(const std::string & s) :
{
}
-DB::Command::~Command()
-{
-}
+DB::Command::~Command() = default;
DB::ParameterTypeNotSupported::ParameterTypeNotSupported()
{
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index f7c7b53..a7092e5 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -23,9 +23,7 @@ DB::Connection::Connection() :
{
}
-DB::Connection::~Connection()
-{
-}
+DB::Connection::~Connection() = default;
void
DB::Connection::execute(const std::string & sql, const CommandOptionsCPtr & opts)
diff --git a/libdbpp/connectionPool.h b/libdbpp/connectionPool.h
index a3312ce..f7760aa 100644
--- a/libdbpp/connectionPool.h
+++ b/libdbpp/connectionPool.h
@@ -22,6 +22,7 @@ namespace DB {
void testResource(Connection const *) const override;
};
+ /// Standard specialisation of AdHoc::ResourcePool for database connections given a type and connection string.
class DLL_PUBLIC ConnectionPool : public BasicConnectionPool {
public:
/// Create a new connection pool.
diff --git a/libdbpp/dbTypes.h b/libdbpp/dbTypes.h
index a75f0d3..3055974 100644
--- a/libdbpp/dbTypes.h
+++ b/libdbpp/dbTypes.h
@@ -28,6 +28,7 @@ namespace DB {
{
}
+ /// Byte-wise equality operation.
bool operator==(const DB::Blob b) const;
/// The beginning of the binary data.
diff --git a/libdbpp/error.h b/libdbpp/error.h
index 05f0a39..c36d864 100644
--- a/libdbpp/error.h
+++ b/libdbpp/error.h
@@ -36,8 +36,10 @@ namespace DB {
const std::string to;
};
+ /// Exception thrown when a null value occurs when reading into a non-optional value.
class DLL_PUBLIC UnexpectedNullValue : public AdHoc::Exception<Error> {
public:
+ /// Create a new UnexpectedNullValue given the source type name.
UnexpectedNullValue(const char * const from);
private:
diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h
index d3e5bff..8a2c2cf 100644
--- a/libdbpp/mockDatabase.h
+++ b/libdbpp/mockDatabase.h
@@ -13,7 +13,6 @@ namespace DB {
class DLL_PUBLIC MockDatabase : public AdHoc::AbstractPluginImplementation {
public:
/// Creates and registers a new database.
- /// @param mockName the name the database will register as.
virtual ~MockDatabase() = default;
/// Open a connection to this database instance.
@@ -60,9 +59,14 @@ class DLL_PUBLIC MockServerDatabase : public MockDatabase {
const std::string testDbName;
};
+/// Helper class for creating instances of mock databases
template<typename T>
class PluginMock {
public:
+ /// Create and register a new mock database.
+ /// @param name the name of the mock database to register.
+ /// @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) :
mockName(name)
@@ -73,6 +77,7 @@ class PluginMock {
{
AdHoc::PluginManager::getDefault()->remove<MockDatabase>(mockName);
}
+ /// Get the name of the mock database.
const std::string & databaseName() const
{
return std::dynamic_pointer_cast<MockServerDatabase>(AdHoc::PluginManager::getDefault()->get<MockDatabase>(mockName)->implementation())->databaseName();
diff --git a/libdbpp/modifycommand.cpp b/libdbpp/modifycommand.cpp
index f46a6a2..b3bd36d 100644
--- a/libdbpp/modifycommand.cpp
+++ b/libdbpp/modifycommand.cpp
@@ -5,9 +5,7 @@ DB::ModifyCommand::ModifyCommand(const std::string & s) :
{
}
-DB::ModifyCommand::~ModifyCommand()
-{
-}
+DB::ModifyCommand::~ModifyCommand() = default;
DB::NoRowsAffected::NoRowsAffected()
{
diff --git a/libdbpp/selectcommand.cpp b/libdbpp/selectcommand.cpp
index d47137d..1e67ce6 100644
--- a/libdbpp/selectcommand.cpp
+++ b/libdbpp/selectcommand.cpp
@@ -35,14 +35,11 @@ namespace DB {
DB::SelectCommand::SelectCommand(const std::string & sql) :
DB::Command(sql),
- columns(new Columns)
+ columns(std::make_unique<Columns>())
{
}
-DB::SelectCommand::~SelectCommand()
-{
- delete columns;
-}
+DB::SelectCommand::~SelectCommand() = default;
const DB::Column&
DB::SelectCommand::operator[](unsigned int n) const
diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h
index 5399b01..05ec2ce 100644
--- a/libdbpp/selectcommand.h
+++ b/libdbpp/selectcommand.h
@@ -133,17 +133,19 @@ namespace DB {
class Columns;
/// Columns in the result set.
- Columns * columns;
+ std::unique_ptr<Columns> columns;
};
}
namespace std {
+ /// @cond
template<typename ... Fn> struct tuple_size<DB::Row<Fn...>> {
static constexpr auto value = sizeof...(Fn);
};
template<size_t C, typename ... Fn> struct tuple_element<C, DB::Row<Fn...>> {
typedef typename std::tuple_element<C, std::tuple<Fn...>>::type type;
};
+ /// @endcond
}
#endif