From b5d76bf8ab11e73b260cbc4343c1f947c0da2699 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 25 Mar 2011 13:04:55 +0200 Subject: Query support --- odb/sqlite/result.hxx | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 odb/sqlite/result.hxx (limited to 'odb/sqlite/result.hxx') diff --git a/odb/sqlite/result.hxx b/odb/sqlite/result.hxx new file mode 100644 index 0000000..187589e --- /dev/null +++ b/odb/sqlite/result.hxx @@ -0,0 +1,89 @@ +// file : odb/sqlite/result.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SQLITE_RESULT_HXX +#define ODB_SQLITE_RESULT_HXX + +#include + +#include // std::size_t + +#include + +#include +#include +#include +#include + +#include + +namespace odb +{ + namespace sqlite + { + class result_impl_base + { + public: + result_impl_base (const query&, details::shared_ptr); + + protected: + // We need to hold on to the query parameters because SQLite uses + // the parameter buffers to find each next row. + // + details::shared_ptr params_; + details::shared_ptr statement_; + }; + + template + class result_impl: public odb::result_impl, public result_impl_base + { + public: + typedef typename odb::result_impl::pointer_type pointer_type; + typedef typename odb::result_impl::pointer_traits pointer_traits; + + typedef typename odb::result_impl::object_type object_type; + typedef typename odb::result_impl::id_type id_type; + typedef typename odb::result_impl::object_traits object_traits; + + + virtual + ~result_impl (); + + result_impl (const query&, + details::shared_ptr, + object_statements&); + + virtual void + load (object_type&); + + virtual id_type + load_id (); + + virtual void + next (); + + virtual void + cache (); + + virtual std::size_t + size (); + + using odb::result_impl::current; + + private: + void + load_image (); + + private: + object_statements& statements_; + }; + } +} + +#include + +#include + +#endif // ODB_SQLITE_RESULT_HXX -- cgit v1.1