diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-06 18:00:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-06 18:00:43 +0200 |
commit | 5daaa1a6d9c8f5d3a4ad3d7009df564bc6506424 (patch) | |
tree | b96d205208587208a4e443be192fe264d2f53d57 /odb/mysql/container-statements.txx | |
parent | 6fd2fb44263eb6704905cddcc607462c21c5e687 (diff) |
Add support for container persistence
Generalize statements that were used for persisting objects to work for
both objects and containers. Implement a cache for container statements.
Diffstat (limited to 'odb/mysql/container-statements.txx')
-rw-r--r-- | odb/mysql/container-statements.txx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/odb/mysql/container-statements.txx b/odb/mysql/container-statements.txx new file mode 100644 index 0000000..a4bb7e5 --- /dev/null +++ b/odb/mysql/container-statements.txx @@ -0,0 +1,35 @@ +// file : odb/mysql/container-statements.txx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <cstddef> // std::size_t +#include <cstring> // std::memset + +namespace odb +{ + namespace mysql + { + // container_statements + // + + template <typename T> + container_statements<T>:: + container_statements (connection& conn) + : conn_ (conn), + functions_ (this, + &traits::insert_one, + &traits::load_all, + &traits::delete_all), + 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_error_, 0, sizeof (data_image_error_)); + + for (std::size_t i (0); i < traits::data_column_count; ++i) + data_image_bind_[i].error = data_image_error_ + i; + } + } +} |