aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/container-statements.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-22 16:22:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-22 16:22:06 +0200
commitbe5909a7fc240c007bb0128353d493af947a8749 (patch)
tree84f4e6488adcde96e5e41a691c191035da6e92c1 /odb/sqlite/container-statements.txx
parent878a448f86ddd60e5eb7778e88edd965003ea480 (diff)
Add object and container statement caches
Diffstat (limited to 'odb/sqlite/container-statements.txx')
-rw-r--r--odb/sqlite/container-statements.txx36
1 files changed, 36 insertions, 0 deletions
diff --git a/odb/sqlite/container-statements.txx b/odb/sqlite/container-statements.txx
new file mode 100644
index 0000000..23466df
--- /dev/null
+++ b/odb/sqlite/container-statements.txx
@@ -0,0 +1,36 @@
+// file : odb/sqlite/container-statements.txx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cstddef> // std::size_t
+#include <cstring> // std::memset
+
+namespace odb
+{
+ namespace sqlite
+ {
+ // container_statements
+ //
+
+ template <typename T>
+ container_statements<T>::
+ container_statements (connection_type& conn)
+ : conn_ (conn),
+ functions_ (this,
+ &traits::insert_one,
+ &traits::load_all,
+ &traits::delete_all),
+ id_image_ (0),
+ cond_image_binding_ (cond_image_bind_, traits::cond_column_count),
+ data_image_binding_ (data_image_bind_, traits::data_column_count)
+ {
+ std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_));
+ std::memset (data_image_bind_, 0, sizeof (data_image_bind_));
+ std::memset (data_image_truncated_, 0, sizeof (data_image_truncated_));
+
+ for (std::size_t i (0); i < traits::data_column_count; ++i)
+ data_image_bind_[i].truncated = data_image_truncated_ + i;
+ }
+ }
+}