diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-12-21 15:35:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-12-21 15:35:51 +0200 |
commit | 0086d1a3630f1a75dda2ebd478e97635d5c9c999 (patch) | |
tree | fb91e4bc060fd54498bc17417407df1366be8875 | |
parent | 70f5ee0069039e7859f28652bc9f600f31a59232 (diff) |
Do not select object id in container SELECT statement
-rw-r--r-- | odb/mysql/container-statements.hxx | 26 | ||||
-rw-r--r-- | odb/mysql/container-statements.txx | 24 |
2 files changed, 36 insertions, 14 deletions
diff --git a/odb/mysql/container-statements.hxx b/odb/mysql/container-statements.hxx index a4bfce2..98d3720 100644 --- a/odb/mysql/container-statements.hxx +++ b/odb/mysql/container-statements.hxx @@ -157,6 +157,18 @@ namespace odb return data_image_truncated_; } + binding& + select_image_binding () + { + return select_image_binding_; + } + + my_bool* + select_image_truncated () + { + return select_image_truncated_; + } + // // Statements. // @@ -181,7 +193,7 @@ namespace odb conn_, select_all_text_, cond_image_binding_, - data_image_binding_, + select_image_binding_, false)); return *select_all_; @@ -212,15 +224,19 @@ namespace odb std::size_t cond_image_version_; std::size_t cond_id_binding_version_; binding cond_image_binding_; - MYSQL_BIND* cond_image_bind_; data_image_type data_image_; std::size_t data_image_version_; std::size_t data_id_binding_version_; + binding data_image_binding_; - MYSQL_BIND* data_image_bind_; my_bool* data_image_truncated_; + // Skips the id from data_image_binding. + // + binding select_image_binding_; + my_bool* select_image_truncated_; + const char* insert_one_text_; const char* select_all_text_; const char* delete_all_text_; @@ -247,8 +263,8 @@ namespace odb container_statements_impl& operator= (const container_statements_impl&); private: - MYSQL_BIND cond_image_bind_array_[traits::cond_column_count]; - MYSQL_BIND data_image_bind_array_[traits::data_column_count]; + 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]; }; } diff --git a/odb/mysql/container-statements.txx b/odb/mysql/container-statements.txx index a993d31..c54d785 100644 --- a/odb/mysql/container-statements.txx +++ b/odb/mysql/container-statements.txx @@ -22,8 +22,9 @@ namespace odb &traits::load_all, &traits::delete_all), id_binding_ (0), - cond_image_binding_ (0, 0), // Initialized by impl. - data_image_binding_ (0, 0) // Initialized by impl. + cond_image_binding_ (0, 0), // Initialized by impl. + data_image_binding_ (0, 0), // Initialized by impl. + select_image_binding_ (0, 0) // Initialized by impl. { cond_image_.version = 0; cond_image_version_ = 0; @@ -39,24 +40,29 @@ namespace odb container_statements_impl (connection_type& conn) : base (conn) { - this->cond_image_bind_ = cond_image_bind_array_; - this->data_image_bind_ = data_image_bind_array_; this->data_image_truncated_ = data_image_truncated_array_; + this->select_image_truncated_ = data_image_truncated_array_ + + traits::id_column_count; - this->cond_image_binding_.bind = this->cond_image_bind_; + this->cond_image_binding_.bind = cond_image_bind_; this->cond_image_binding_.count = traits::cond_column_count; - this->data_image_binding_.bind = this->data_image_bind_; + this->data_image_binding_.bind = data_image_bind_; this->data_image_binding_.count = traits::data_column_count; - std::memset (cond_image_bind_array_, 0, sizeof (cond_image_bind_array_)); - std::memset (data_image_bind_array_, 0, sizeof (data_image_bind_array_)); + this->select_image_binding_.bind = data_image_bind_ + + traits::id_column_count; + this->select_image_binding_.count = traits::data_column_count - + traits::id_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_array_, 0, sizeof (data_image_truncated_array_)); for (std::size_t i (0); i < traits::data_column_count; ++i) - data_image_bind_array_[i].error = data_image_truncated_array_ + i; + data_image_bind_[i].error = data_image_truncated_array_ + i; this->insert_one_text_ = traits::insert_one_statement; this->select_all_text_ = traits::select_all_statement; |