aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/sqlite/container-statements.hxx26
-rw-r--r--odb/sqlite/container-statements.txx24
2 files changed, 36 insertions, 14 deletions
diff --git a/odb/sqlite/container-statements.hxx b/odb/sqlite/container-statements.hxx
index db59ead..c839872 100644
--- a/odb/sqlite/container-statements.hxx
+++ b/odb/sqlite/container-statements.hxx
@@ -156,6 +156,18 @@ namespace odb
return data_image_truncated_;
}
+ binding&
+ select_image_binding ()
+ {
+ return select_image_binding_;
+ }
+
+ bool*
+ select_image_truncated ()
+ {
+ return select_image_truncated_;
+ }
+
//
// Statements.
//
@@ -185,7 +197,7 @@ namespace odb
conn_,
select_all_text_,
cond_image_binding_,
- data_image_binding_));
+ select_image_binding_));
select_all_->cached (true);
}
@@ -222,15 +234,19 @@ namespace odb
std::size_t cond_image_version_;
std::size_t cond_id_binding_version_;
binding cond_image_binding_;
- 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_;
- bind* data_image_bind_;
bool* data_image_truncated_;
+ // Skips the id from data_image_binding.
+ //
+ binding select_image_binding_;
+ bool* select_image_truncated_;
+
const char* insert_one_text_;
const char* select_all_text_;
const char* delete_all_text_;
@@ -257,8 +273,8 @@ namespace odb
container_statements_impl& operator= (const container_statements_impl&);
private:
- bind cond_image_bind_array_[traits::cond_column_count];
- bind data_image_bind_array_[traits::data_column_count];
+ bind cond_image_bind_[traits::cond_column_count];
+ bind data_image_bind_[traits::data_column_count];
bool data_image_truncated_array_[traits::data_column_count];
};
}
diff --git a/odb/sqlite/container-statements.txx b/odb/sqlite/container-statements.txx
index 5cf3463..43afb39 100644
--- a/odb/sqlite/container-statements.txx
+++ b/odb/sqlite/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].truncated = data_image_truncated_array_ + i;
+ data_image_bind_[i].truncated = data_image_truncated_array_ + i;
this->insert_one_text_ = traits::insert_one_statement;
this->select_all_text_ = traits::select_all_statement;