summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/Doxyfile328
-rw-r--r--libdbpp/column.h22
-rw-r--r--libdbpp/command.h16
-rw-r--r--libdbpp/connection.h26
-rw-r--r--libdbpp/error.h5
-rw-r--r--libdbpp/mockDatabase.h21
-rw-r--r--libdbpp/modifycommand.h5
-rw-r--r--libdbpp/selectcommand.h15
-rw-r--r--libdbpp/sqlParse.h2
-rw-r--r--libdbpp/testCore.h2
10 files changed, 439 insertions, 3 deletions
diff --git a/libdbpp/Doxyfile b/libdbpp/Doxyfile
new file mode 100644
index 0000000..d75c42f
--- /dev/null
+++ b/libdbpp/Doxyfile
@@ -0,0 +1,328 @@
+# Doxyfile 1.8.10
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = libdbpp
+PROJECT_NUMBER = 0.9
+PROJECT_BRIEF = "Base classes and functionality for C++ database connectivity."
+PROJECT_LOGO =
+OUTPUT_DIRECTORY = bin
+CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 4
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+MARKDOWN_SUPPORT = YES
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS = NO
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = YES
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = .
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.h
+RECURSIVE = YES
+EXCLUDE = bin unittests
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS =
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = NO
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = NO
+HTML_DYNAMIC_SECTIONS = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = Publisher
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = NO
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = NO
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = YES
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED = DLL_PRIVATE= \
+ DLL_PUBLIC=
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = NO
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/libdbpp/column.h b/libdbpp/column.h
index c94cbe3..37f3b88 100644
--- a/libdbpp/column.h
+++ b/libdbpp/column.h
@@ -7,34 +7,56 @@
#include <visibility.h>
namespace DB {
+ /// Abstract class for something that can handle field data. See Column::apply.
class DLL_PUBLIC HandleField {
public:
+ /// The field is null.
virtual void null() = 0;
+ /// The field contains text data.
virtual void string(const char *, size_t len) = 0;
+ /// The field is an integer.
virtual void integer(int64_t) = 0;
+ /// The field is a boolean/bit.
virtual void boolean(bool) = 0;
+ /// The field is floating point/fixed point/numeric.
virtual void floatingpoint(double) = 0;
+ /// The field is an interval/duration/time span.
virtual void interval(const boost::posix_time::time_duration &) = 0;
+ /// The field is a timestamp/date/datetime.
virtual void timestamp(const boost::posix_time::ptime &) = 0;
};
+
class Command;
+ /// Represents a column in a result set and provides access to the current rows data.
class DLL_PUBLIC Column {
public:
+ /// Creates a new column with the given name and ordinal.
Column(const Glib::ustring &, unsigned int);
virtual ~Column() = 0;
+ /// Test if the current value is null.
virtual bool isNull() const = 0;
+ /// Apply a field handler (any sub-class of HandleField)
virtual void apply(HandleField &) const = 0;
+ /// Rebind this field to another command (limited support).
virtual void rebind(Command *, unsigned int) const = 0;
+ /// STL like string extractor.
void operator>>(std::string &) const;
+ /// STL like boolean extractor.
void operator>>(bool &) const;
+ /// STL like integer extractor.
void operator>>(int64_t &) const;
+ /// STL like numeric extractor.
void operator>>(double &) const;
+ /// STL like duration extractor.
void operator>>(boost::posix_time::time_duration &) const;
+ /// STL like date time extractor.
void operator>>(boost::posix_time::ptime &) const;
+ /// This column's ordinal.
const unsigned int colNo;
+ /// This column's name.
const Glib::ustring name;
};
typedef boost::shared_ptr<Column> ColumnPtr;
diff --git a/libdbpp/command.h b/libdbpp/command.h
index 20e2c83..85c73d5 100644
--- a/libdbpp/command.h
+++ b/libdbpp/command.h
@@ -6,30 +6,46 @@
#include <visibility.h>
namespace DB {
+ /// Represents the basics of any command to be executed against a database.
class DLL_PUBLIC Command {
public:
+ /// Creates a new command from the given SQL.
Command(const std::string & sql);
virtual ~Command() = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, int val) = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, long val) = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, long long val) = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, unsigned int val) = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, unsigned long int val) = 0;
+ /// Bind an integer to parameter i.
virtual void bindParamI(unsigned int i, unsigned long long int val) = 0;
+ /// Bind a boolean to parameter i.
virtual void bindParamB(unsigned int i, bool val) = 0;
+ /// Bind a floating point number to parameter i.
virtual void bindParamF(unsigned int i, double val) = 0;
+ /// Bind a floating point number to parameter i.
virtual void bindParamF(unsigned int i, float val) = 0;
+ /// Bind a string to parameter i.
virtual void bindParamS(unsigned int i, const Glib::ustring &) = 0;
+ /// Bind a duration to parameter i.
virtual void bindParamT(unsigned int i, const boost::posix_time::time_duration &) = 0;
+ /// Bind a date time to parameter i.
virtual void bindParamT(unsigned int i, const boost::posix_time::ptime &) = 0;
+ /// Bind null to parameter i.
virtual void bindNull(unsigned int i) = 0;
+ /// The SQL statement.
const std::string sql;
};
}
diff --git a/libdbpp/connection.h b/libdbpp/connection.h
index 523fb03..c9111f8 100644
--- a/libdbpp/connection.h
+++ b/libdbpp/connection.h
@@ -19,31 +19,55 @@ namespace DB {
BulkUpdateUsingFromSrc,
BulkUpdateUsingJoin,
};
+ /// Base class for connections to a database.
class DLL_PUBLIC Connection {
public:
virtual ~Connection();
+ /// Perform final checks before closing.
virtual void finish() const = 0;
+ /// Open a new transaction.
virtual int beginTx() const = 0;
+ /// Commit an open transaction.
virtual int commitTx() const = 0;
+ /// Rollback an open transaction.
virtual int rollbackTx() const = 0;
+ /// Test to see if a transaction is currently open.
virtual bool inTx() const = 0;
+ /// Create a named save point.
virtual void savepoint(const std::string &) const;
+ /// Rollback to a named save point.
virtual void rollbackToSavepoint(const std::string &) const;
+ /// Release a named save point.
virtual void releaseSavepoint(const std::string &) const;
+ /// Test server connection availability.
virtual void ping() const = 0;
+ /// @cond
virtual BulkDeleteStyle bulkDeleteStyle() const = 0;
virtual BulkUpdateStyle bulkUpdateStyle() const = 0;
+ /// @endcond
+ /// Straight up execute a statement (no access to result set)
virtual void execute(const std::string & sql) const;
+ /// 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) const;
+ /// Create a new select command with the given SQL.
virtual SelectCommand * newSelectCommand(const std::string & sql) const = 0;
+ /// Create a new modify command with the given SQL.
virtual ModifyCommand * newModifyCommand(const std::string & sql) const = 0;
- virtual void beginBulkUpload(const char *, const char *) const = 0;
+ /// Begin a bulk upload operation.
+ /// @param table the target table.
+ /// @param opts database specific options to the load command.
+ virtual void beginBulkUpload(const char * table, const char * opts) const = 0;
+ /// Finish a bulk upload operation.
virtual void endBulkUpload(const char *) const = 0;
+ /// Load data for the current bulk load operation.
virtual size_t bulkUploadData(const char *, size_t) const = 0;
+ /// AdHoc plugin resolver helper for database connectors.
static boost::optional<std::string> resolvePlugin(const std::type_info &, const std::string &);
private:
};
diff --git a/libdbpp/error.h b/libdbpp/error.h
index ab55524..8e5c659 100644
--- a/libdbpp/error.h
+++ b/libdbpp/error.h
@@ -6,12 +6,17 @@
#include <visibility.h>
namespace DB {
+ /// Base class for database errors.
class DLL_PUBLIC Error : public virtual std::exception { };
+ /// Base class for database connectivity errors.
class DLL_PUBLIC ConnectionError : public Error {
public:
+ /// Default constructor, sets FailureTime to now.
ConnectionError();
+ /// Construct with a specific failure time.
ConnectionError(time_t);
+ /// The time of connectivity failure.
const time_t FailureTime;
};
}
diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h
index c7654ff..4cd9da1 100644
--- a/libdbpp/mockDatabase.h
+++ b/libdbpp/mockDatabase.h
@@ -9,22 +9,35 @@
namespace DB {
+/// MockDatabase creates, registers and destroys a database suitable for unit testing.
class DLL_PUBLIC MockDatabase : public AdHoc::AbstractPluginImplementation {
public:
+ /// Creates and registers a new database.
+ /// @param mockName the name the database will register as.
MockDatabase(const std::string & mockName);
virtual ~MockDatabase();
+ /// Open a connection to this database instance.
virtual DB::Connection * openConnection() const = 0;
+
+ /// Open a connection to a named mock database.
static Connection * openConnectionTo(const std::string &);
protected:
+ /// 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;
+ /// Execute a single setup script.
virtual void PlaySchemaScript(DB::Connection *, const boost::filesystem::path & s) const;
+ /// Implementation specific method to drop a database.
virtual void DropDatabase() const = 0;
+ /// Update the status table.
virtual void UpdateStatusTable(DB::Connection *, const boost::filesystem::path &) const;
+ /// The name of this mocked database.
const std::string mockName;
+ /// Internal counter of mocked databases (for unique name generation)
static unsigned int mocked;
private:
@@ -32,8 +45,14 @@ class DLL_PUBLIC MockDatabase : public AdHoc::AbstractPluginImplementation {
void DropStatusTable(DB::Connection *) const;
};
+/// MockServerDatabase extends MockDatabase with the functionality to connect to a database service
+/// and create your mock on there.
class DLL_PUBLIC MockServerDatabase : public MockDatabase {
public:
+ /// Create and register a new database.
+ /// @param masterdb connection to server with permissions to create a new database.
+ /// @param name the name of the mock to register as.
+ /// @param type the database type.
MockServerDatabase(const std::string & masterdb, const std::string & name, const std::string & type);
virtual ~MockServerDatabase();
@@ -41,7 +60,9 @@ class DLL_PUBLIC MockServerDatabase : public MockDatabase {
virtual void CreateNewDatabase() const override;
virtual void DropDatabase() const override;
+ /// Connection to the master database.
DB::Connection * master;
+ /// The name of the database that was created on the server.
const std::string testDbName;
};
diff --git a/libdbpp/modifycommand.h b/libdbpp/modifycommand.h
index 4cc8e72..69e45d5 100644
--- a/libdbpp/modifycommand.h
+++ b/libdbpp/modifycommand.h
@@ -5,11 +5,14 @@
#include <visibility.h>
namespace DB {
+ /// Presents a command not expected to return any data.
class DLL_PUBLIC ModifyCommand : public virtual Command {
public:
+ /// Creates a new command from the given SQL.
ModifyCommand(const std::string & sql);
~ModifyCommand();
- // Execute the command and return effected row count
+
+ /// Execute the command and return effected row count
virtual unsigned int execute(bool allowNoChange = true) = 0;
};
}
diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h
index ff6f529..3887088 100644
--- a/libdbpp/selectcommand.h
+++ b/libdbpp/selectcommand.h
@@ -11,24 +11,37 @@
namespace DB {
class Column;
+ /// Represents a command expected to return data to the client.
class DLL_PUBLIC SelectCommand : public virtual Command {
public:
+ /// Creates a new command from the given SQL.
SelectCommand(const std::string & sql);
~SelectCommand();
+
+ /// Fetch the next row from the result set. Returns false when no further rows are availabile.
virtual bool fetch() = 0;
+ /// Execute the statement, but don't fetch the first row.
virtual void execute() = 0;
+ /// Get a column reference by index.
const Column & operator[](unsigned int col) const;
+ /// Get a column reference by name.
const Column & operator[](const Glib::ustring &) const;
+ /// Get the number of columns in the result set.
unsigned int columnCount() const;
+ /// Get the index of a column by name.
unsigned int getOrdinal(const Glib::ustring &) const;
+
+ protected:
+ /// Helper function so clients need not know about boost::multi_index_container.
ColumnPtr insertColumn(ColumnPtr);
+ /// Friendly typedef cos boost::multi_index_container definitions are massive.
typedef boost::multi_index_container<ColumnPtr, boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const unsigned int, &DB::Column::colNo>>,
boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const Glib::ustring, &DB::Column::name>>
>> Columns;
- protected:
+ /// Columns in the result set.
Columns * columns;
};
}
diff --git a/libdbpp/sqlParse.h b/libdbpp/sqlParse.h
index ad001bb..dcdf073 100644
--- a/libdbpp/sqlParse.h
+++ b/libdbpp/sqlParse.h
@@ -12,6 +12,7 @@
namespace DB {
+/// @cond
class SqlParse : public yyFlexLexer {
public:
SqlParse(std::istream &, const boost::filesystem::path &, const Connection *);
@@ -29,6 +30,7 @@ class SqlParse : public yyFlexLexer {
std::string comment;
std::string statement;
};
+/// @endcond
}
diff --git a/libdbpp/testCore.h b/libdbpp/testCore.h
index 81dac8a..eb53c43 100644
--- a/libdbpp/testCore.h
+++ b/libdbpp/testCore.h
@@ -8,6 +8,7 @@ namespace DB {
class SelectCommand;
+/// @cond
class DLL_PUBLIC TestCore {
protected:
TestCore();
@@ -22,6 +23,7 @@ class DLL_PUBLIC TestCore {
template<typename T> void assertScalarValueHelper(SelectCommand & sel, const T & t) const;
template<typename T> void assertColumnValueHelper(SelectCommand & sel, unsigned int col, const T & t) const;
};
+/// @endcond
}