aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:45:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-19 11:40:30 +0200
commit5dd712307b5ee1e85cf7101c27e9bb978af26976 (patch)
tree29a0569ea455bca893741dd5b5e858d41a9d1f12
parent8112bd0febcfa1e3a76e0d03363facbefc3822f7 (diff)
Get rid of result_impl_base
-rw-r--r--odb/sqlite/makefile1
-rw-r--r--odb/sqlite/no-id-object-result.hxx11
-rw-r--r--odb/sqlite/no-id-object-result.txx3
-rw-r--r--odb/sqlite/polymorphic-object-result.hxx11
-rw-r--r--odb/sqlite/polymorphic-object-result.txx5
-rw-r--r--odb/sqlite/result.cxx19
-rw-r--r--odb/sqlite/result.hxx40
-rw-r--r--odb/sqlite/simple-object-result.hxx11
-rw-r--r--odb/sqlite/simple-object-result.txx11
-rw-r--r--odb/sqlite/view-result.hxx10
-rw-r--r--odb/sqlite/view-result.txx11
11 files changed, 45 insertions, 88 deletions
diff --git a/odb/sqlite/makefile b/odb/sqlite/makefile
index 1f9e0ae..30c55c7 100644
--- a/odb/sqlite/makefile
+++ b/odb/sqlite/makefile
@@ -13,7 +13,6 @@ exceptions.cxx \
prepared-query.cxx \
query.cxx \
query-const-expr.cxx \
-result.cxx \
simple-object-statements.cxx \
statement.cxx \
statements-base.cxx \
diff --git a/odb/sqlite/no-id-object-result.hxx b/odb/sqlite/no-id-object-result.hxx
index 3b653bb..f1b7b59 100644
--- a/odb/sqlite/no-id-object-result.hxx
+++ b/odb/sqlite/no-id-object-result.hxx
@@ -14,8 +14,7 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/sqlite/version.hxx>
-#include <odb/sqlite/forward.hxx> // query_base
-#include <odb/sqlite/result.hxx>
+#include <odb/sqlite/forward.hxx> // query_base, query_params
#include <odb/sqlite/statement.hxx>
namespace odb
@@ -23,8 +22,7 @@ namespace odb
namespace sqlite
{
template <typename T>
- class no_id_object_result_impl: public odb::no_id_object_result_impl<T>,
- public result_impl_base
+ class no_id_object_result_impl: public odb::no_id_object_result_impl<T>
{
public:
typedef odb::no_id_object_result_impl<T> base_type;
@@ -62,6 +60,11 @@ namespace odb
using base_type::current;
private:
+ // We need to hold on to the query parameters because SQLite uses
+ // the parameter buffers to find each next row.
+ //
+ details::shared_ptr<query_params> params_;
+ details::shared_ptr<select_statement> statement_;
statements_type& statements_;
};
}
diff --git a/odb/sqlite/no-id-object-result.txx b/odb/sqlite/no-id-object-result.txx
index 9ffb836..3cd3086 100644
--- a/odb/sqlite/no-id-object-result.txx
+++ b/odb/sqlite/no-id-object-result.txx
@@ -39,7 +39,8 @@ namespace odb
const details::shared_ptr<select_statement>& s,
statements_type& sts)
: base_type (sts.connection ()),
- result_impl_base (q, s),
+ params_ (q.parameters ()),
+ statement_ (s),
statements_ (sts)
{
}
diff --git a/odb/sqlite/polymorphic-object-result.hxx b/odb/sqlite/polymorphic-object-result.hxx
index 0b03456..a56eb5b 100644
--- a/odb/sqlite/polymorphic-object-result.hxx
+++ b/odb/sqlite/polymorphic-object-result.hxx
@@ -14,8 +14,7 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/sqlite/version.hxx>
-#include <odb/sqlite/forward.hxx> // query_base
-#include <odb/sqlite/result.hxx>
+#include <odb/sqlite/forward.hxx> // query_base, query_params
#include <odb/sqlite/statement.hxx>
namespace odb
@@ -24,8 +23,7 @@ namespace odb
{
template <typename T>
class polymorphic_object_result_impl:
- public odb::polymorphic_object_result_impl<T>,
- public result_impl_base
+ public odb::polymorphic_object_result_impl<T>
{
public:
typedef odb::polymorphic_object_result_impl<T> base_type;
@@ -80,6 +78,11 @@ namespace odb
load_image ();
private:
+ // We need to hold on to the query parameters because SQLite uses
+ // the parameter buffers to find each next row.
+ //
+ details::shared_ptr<query_params> params_;
+ details::shared_ptr<select_statement> statement_;
statements_type& statements_;
};
}
diff --git a/odb/sqlite/polymorphic-object-result.txx b/odb/sqlite/polymorphic-object-result.txx
index 8e09bf1..486af8e 100644
--- a/odb/sqlite/polymorphic-object-result.txx
+++ b/odb/sqlite/polymorphic-object-result.txx
@@ -39,10 +39,11 @@ namespace odb
polymorphic_object_result_impl<T>::
polymorphic_object_result_impl (
const query_base& q,
- const details::shared_ptr<select_statement>& st,
+ const details::shared_ptr<select_statement>& s,
statements_type& sts)
: base_type (sts.connection ()),
- result_impl_base (q, st),
+ params_ (q.parameters ()),
+ statement_ (s),
statements_ (sts)
{
}
diff --git a/odb/sqlite/result.cxx b/odb/sqlite/result.cxx
deleted file mode 100644
index ccd6c05..0000000
--- a/odb/sqlite/result.cxx
+++ /dev/null
@@ -1,19 +0,0 @@
-// file : odb/sqlite/result.cxx
-// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#include <odb/sqlite/result.hxx>
-#include <odb/sqlite/query.hxx>
-
-namespace odb
-{
- namespace sqlite
- {
- result_impl_base::
- result_impl_base (const query_base& q,
- const details::shared_ptr<select_statement>& s)
- : params_ (q.parameters ()), statement_ (s)
- {
- }
- }
-}
diff --git a/odb/sqlite/result.hxx b/odb/sqlite/result.hxx
deleted file mode 100644
index 6e915d4..0000000
--- a/odb/sqlite/result.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-// file : odb/sqlite/result.hxx
-// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_SQLITE_RESULT_HXX
-#define ODB_SQLITE_RESULT_HXX
-
-#include <odb/pre.hxx>
-
-#include <odb/details/shared-ptr.hxx>
-
-#include <odb/sqlite/version.hxx>
-#include <odb/sqlite/forward.hxx> // query_base, query_params
-#include <odb/sqlite/statement.hxx>
-
-#include <odb/sqlite/details/export.hxx>
-
-namespace odb
-{
- namespace sqlite
- {
- class LIBODB_SQLITE_EXPORT result_impl_base
- {
- public:
- result_impl_base (const query_base&,
- const details::shared_ptr<select_statement>&);
-
- protected:
- // We need to hold on to the query parameters because SQLite uses
- // the parameter buffers to find each next row.
- //
- details::shared_ptr<query_params> params_;
- details::shared_ptr<select_statement> statement_;
- };
- }
-}
-
-#include <odb/post.hxx>
-
-#endif // ODB_SQLITE_RESULT_HXX
diff --git a/odb/sqlite/simple-object-result.hxx b/odb/sqlite/simple-object-result.hxx
index 02b671e..5632a13 100644
--- a/odb/sqlite/simple-object-result.hxx
+++ b/odb/sqlite/simple-object-result.hxx
@@ -14,8 +14,7 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/sqlite/version.hxx>
-#include <odb/sqlite/forward.hxx> // query_base
-#include <odb/sqlite/result.hxx>
+#include <odb/sqlite/forward.hxx> // query_base, query_params
#include <odb/sqlite/statement.hxx>
namespace odb
@@ -23,8 +22,7 @@ namespace odb
namespace sqlite
{
template <typename T>
- class object_result_impl: public odb::object_result_impl<T>,
- public result_impl_base
+ class object_result_impl: public odb::object_result_impl<T>
{
public:
typedef odb::object_result_impl<T> base_type;
@@ -70,6 +68,11 @@ namespace odb
load_image ();
private:
+ // We need to hold on to the query parameters because SQLite uses
+ // the parameter buffers to find each next row.
+ //
+ details::shared_ptr<query_params> params_;
+ details::shared_ptr<select_statement> statement_;
statements_type& statements_;
};
}
diff --git a/odb/sqlite/simple-object-result.txx b/odb/sqlite/simple-object-result.txx
index 1de4b91..e8f2233 100644
--- a/odb/sqlite/simple-object-result.txx
+++ b/odb/sqlite/simple-object-result.txx
@@ -38,11 +38,12 @@ namespace odb
template <typename T>
object_result_impl<T>::
object_result_impl (const query_base& q,
- const details::shared_ptr<select_statement>& statement,
- statements_type& statements)
- : base_type (statements.connection ()),
- result_impl_base (q, statement),
- statements_ (statements)
+ const details::shared_ptr<select_statement>& s,
+ statements_type& sts)
+ : base_type (sts.connection ()),
+ params_ (q.parameters ()),
+ statement_ (s),
+ statements_ (sts)
{
}
diff --git a/odb/sqlite/view-result.hxx b/odb/sqlite/view-result.hxx
index a6d07e7..4d27367 100644
--- a/odb/sqlite/view-result.hxx
+++ b/odb/sqlite/view-result.hxx
@@ -14,7 +14,7 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/sqlite/version.hxx>
-#include <odb/sqlite/forward.hxx> // query_base, view_statements
+#include <odb/sqlite/forward.hxx> // query_base, query_params
#include <odb/sqlite/statement.hxx>
namespace odb
@@ -22,8 +22,7 @@ namespace odb
namespace sqlite
{
template <typename T>
- class view_result_impl: public odb::view_result_impl<T>,
- public result_impl_base
+ class view_result_impl: public odb::view_result_impl<T>
{
public:
typedef odb::view_result_impl<T> base_type;
@@ -61,6 +60,11 @@ namespace odb
using base_type::current;
private:
+ // We need to hold on to the query parameters because SQLite uses
+ // the parameter buffers to find each next row.
+ //
+ details::shared_ptr<query_params> params_;
+ details::shared_ptr<select_statement> statement_;
statements_type& statements_;
};
}
diff --git a/odb/sqlite/view-result.txx b/odb/sqlite/view-result.txx
index ed7fdc8..b6d8cb8 100644
--- a/odb/sqlite/view-result.txx
+++ b/odb/sqlite/view-result.txx
@@ -36,11 +36,12 @@ namespace odb
template <typename T>
view_result_impl<T>::
view_result_impl (const query_base& q,
- const details::shared_ptr<select_statement>& statement,
- statements_type& statements)
- : base_type (statements.connection ()),
- result_impl_base (q, statement),
- statements_ (statements)
+ const details::shared_ptr<select_statement>& s,
+ statements_type& sts)
+ : base_type (sts.connection ()),
+ params_ (q.parameters ()),
+ statement_ (s),
+ statements_ (sts)
{
}