From 4b214c1ece26d6b0a6f36b9ea795119f89273c0d 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/mysql/container-statements.hxx | 10 ++-------- odb/mysql/container-statements.txx | 11 +++++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/odb/mysql/container-statements.hxx b/odb/mysql/container-statements.hxx index 0fed9df..9f1e475 100644 --- a/odb/mysql/container-statements.hxx +++ b/odb/mysql/container-statements.hxx @@ -150,12 +150,6 @@ namespace odb return data_image_binding_; } - my_bool* - data_image_truncated () - { - return data_image_truncated_; - } - binding& select_image_binding () { @@ -229,7 +223,6 @@ namespace odb std::size_t data_id_binding_version_; binding data_image_binding_; - my_bool* data_image_truncated_; // Skips the id from data_image_binding. // @@ -264,7 +257,8 @@ namespace odb private: MYSQL_BIND cond_image_bind_[traits::cond_column_count]; MYSQL_BIND data_image_bind_[traits::data_column_count]; - my_bool data_image_truncated_array_[traits::data_column_count]; + my_bool select_image_truncated_array_[traits::data_column_count - + traits::id_column_count]; }; } } diff --git a/odb/mysql/container-statements.txx b/odb/mysql/container-statements.txx index fa5dfbe..4960d96 100644 --- a/odb/mysql/container-statements.txx +++ b/odb/mysql/container-statements.txx @@ -39,9 +39,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; @@ -56,12 +54,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].error = data_image_truncated_array_ + i; + data_image_bind_[i + traits::id_column_count].error = + select_image_truncated_array_ + i; this->insert_one_text_ = traits::insert_one_statement; this->select_all_text_ = traits::select_all_statement; -- cgit v1.1