summaryrefslogtreecommitdiff
path: root/libmysqlpp/selectcommand.h
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-11-18 19:13:16 +0000
committerrandomdan <randomdan@localhost>2012-11-18 19:13:16 +0000
commit49286cb2d2987e4d2f6a07f6b9ed46d4de97d9ac (patch)
tree9064882e6e44203bf35bf70089500c326458b6f1 /libmysqlpp/selectcommand.h
parentMigrate all stuff to stricter compilations/links and C++0x builds (diff)
downloadlibdbpp-mysql-49286cb2d2987e4d2f6a07f6b9ed46d4de97d9ac.tar.bz2
libdbpp-mysql-49286cb2d2987e4d2f6a07f6b9ed46d4de97d9ac.tar.xz
libdbpp-mysql-49286cb2d2987e4d2f6a07f6b9ed46d4de97d9ac.zip
Add a basic MySQL connector, not fully functional, but will suffice for p2tv
Diffstat (limited to 'libmysqlpp/selectcommand.h')
-rw-r--r--libmysqlpp/selectcommand.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/libmysqlpp/selectcommand.h b/libmysqlpp/selectcommand.h
new file mode 100644
index 0000000..a338599
--- /dev/null
+++ b/libmysqlpp/selectcommand.h
@@ -0,0 +1,44 @@
+#ifndef MY_SELECTCOMMAND_H
+#define MY_SELECTCOMMAND_H
+
+#include "../libdbpp/selectcommand.h"
+#include "../libdbpp/column.h"
+#include "command.h"
+#include <boost/shared_ptr.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/indexed_by.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/member.hpp>
+#include <vector>
+#include <map>
+
+namespace MySQL {
+ class Connection;
+ class ColumnBase;
+ class SelectCommand : public DB::SelectCommand, public Command {
+ public:
+ SelectCommand(const Connection *, const std::string & sql);
+
+ bool fetch();
+ void execute();
+ const DB::Column& operator[](unsigned int) const;
+ const DB::Column& operator[](const Glib::ustring&) const;
+ unsigned int columnCount() const;
+ unsigned int getOrdinal(const Glib::ustring&) const;
+
+ private:
+ bool executed;
+ Binds fields;
+ typedef boost::multi_index_container<boost::shared_ptr<ColumnBase>, 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;
+ Columns columns;
+
+ friend class ColumnBase;
+ };
+}
+
+#endif
+
+