From bae6ada688e0b09c773edc9b9f7e54f98b019cad Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Feb 2012 15:27:01 +0200 Subject: Don't allocate unnecessary entries in container truncation array --- odb/pgsql/container-statements.hxx | 10 ++-------- odb/pgsql/container-statements.txx | 11 +++++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/odb/pgsql/container-statements.hxx b/odb/pgsql/container-statements.hxx index 4967cfb..cf0e0b8 100644 --- a/odb/pgsql/container-statements.hxx +++ b/odb/pgsql/container-statements.hxx @@ -157,12 +157,6 @@ namespace odb return data_image_binding_; } - bool* - data_image_truncated () - { - return data_image_truncated_; - } - native_binding& data_image_native_binding () { @@ -268,7 +262,6 @@ namespace odb std::size_t data_id_binding_version_; binding data_image_binding_; - bool* data_image_truncated_; native_binding data_image_native_binding_; // Skips the id from data_image_binding. @@ -323,7 +316,8 @@ namespace odb int data_image_lengths_[traits::data_column_count]; int data_image_formats_[traits::data_column_count]; - bool data_image_truncated_array_[traits::data_column_count]; + bool select_image_truncated_array_[traits::data_column_count - + traits::id_column_count]; }; } } diff --git a/odb/pgsql/container-statements.txx b/odb/pgsql/container-statements.txx index cc9594d..74948f2 100644 --- a/odb/pgsql/container-statements.txx +++ b/odb/pgsql/container-statements.txx @@ -41,9 +41,7 @@ namespace odb container_statements_impl (connection_type& conn) : base (conn) { - this->data_image_truncated_ = data_image_truncated_array_; - this->select_image_truncated_ = data_image_truncated_array_ + - traits::id_column_count; + this->select_image_truncated_ = select_image_truncated_array_; this->cond_image_binding_.bind = cond_image_bind_; this->cond_image_binding_.count = traits::cond_column_count; @@ -68,12 +66,13 @@ namespace odb 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_array_, + std::memset (select_image_truncated_array_, 0, - sizeof (data_image_truncated_array_)); + sizeof (select_image_truncated_array_)); for (std::size_t i (0); i < traits::data_column_count; ++i) - data_image_bind_[i].truncated = data_image_truncated_array_ + i; + data_image_bind_[i + traits::id_column_count].truncated = + select_image_truncated_array_ + i; this->insert_one_name_ = traits::insert_one_name; this->insert_one_text_ = traits::insert_one_statement; -- cgit v1.1