aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-12-21 15:35:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-12-21 15:35:51 +0200
commit3f1324fd527317e25bbb7de6921fdbecf800a9bf (patch)
tree4daa4093add3e918e510b8ba08b2896fc89ba120
parent30a3f42af1ff45a4e504899a69de7411f966bd97 (diff)
Do not select object id in container SELECT statement
-rw-r--r--odb/pgsql/container-statements.hxx26
-rw-r--r--odb/pgsql/container-statements.txx28
2 files changed, 38 insertions, 16 deletions
diff --git a/odb/pgsql/container-statements.hxx b/odb/pgsql/container-statements.hxx
index 79c6e6b..0b207e9 100644
--- a/odb/pgsql/container-statements.hxx
+++ b/odb/pgsql/container-statements.hxx
@@ -170,6 +170,18 @@ namespace odb
return data_image_native_binding_;
}
+ binding&
+ select_image_binding ()
+ {
+ return select_image_binding_;
+ }
+
+ bool*
+ select_image_truncated ()
+ {
+ return select_image_truncated_;
+ }
+
//
// Statements.
//
@@ -209,7 +221,7 @@ namespace odb
select_all_count_,
cond_image_binding_,
cond_image_native_binding_,
- data_image_binding_,
+ select_image_binding_,
false));
}
@@ -250,17 +262,21 @@ namespace odb
std::size_t cond_image_version_;
std::size_t cond_id_binding_version_;
binding cond_image_binding_;
- bind* cond_image_bind_;
native_binding cond_image_native_binding_;
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_;
native_binding data_image_native_binding_;
+ // Skips the id from data_image_binding.
+ //
+ binding select_image_binding_;
+ bool* select_image_truncated_;
+
const char* insert_one_name_;
const char* insert_one_text_;
const Oid* insert_one_types_;
@@ -298,12 +314,12 @@ namespace odb
container_statements_impl& operator= (const container_statements_impl&);
private:
- bind cond_image_bind_array_[traits::cond_column_count];
+ bind cond_image_bind_[traits::cond_column_count];
char* cond_image_values_[traits::cond_column_count];
int cond_image_lengths_[traits::cond_column_count];
int cond_image_formats_[traits::cond_column_count];
- bind data_image_bind_array_[traits::data_column_count];
+ bind data_image_bind_[traits::data_column_count];
char* data_image_values_[traits::data_column_count];
int data_image_lengths_[traits::data_column_count];
int data_image_formats_[traits::data_column_count];
diff --git a/odb/pgsql/container-statements.txx b/odb/pgsql/container-statements.txx
index 72ce213..56af8a2 100644
--- a/odb/pgsql/container-statements.txx
+++ b/odb/pgsql/container-statements.txx
@@ -22,10 +22,11 @@ namespace odb
&traits::load_all,
&traits::delete_all),
id_binding_ (0),
- cond_image_binding_ (0, 0), // Initialized by impl.
- cond_image_native_binding_ (0, 0, 0, 0), // Initialized by impl.
- data_image_binding_ (0, 0), // Initialized by impl.
- data_image_native_binding_ (0, 0, 0, 0) // Initialized by impl.
+ cond_image_binding_ (0, 0), // Initialized by impl.
+ cond_image_native_binding_ (0, 0, 0, 0), // Initialized by impl.
+ data_image_binding_ (0, 0), // Initialized by impl.
+ data_image_native_binding_ (0, 0, 0, 0), // Initialized by impl.
+ select_image_binding_ (0, 0) // Initialized by impl.
{
cond_image_.version = 0;
cond_image_version_ = 0;
@@ -41,16 +42,21 @@ 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;
+ 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;
+
this->cond_image_native_binding_.values = cond_image_values_;
this->cond_image_native_binding_.lengths = cond_image_lengths_;
this->cond_image_native_binding_.formats = cond_image_formats_;
@@ -61,14 +67,14 @@ namespace odb
this->data_image_native_binding_.formats = data_image_formats_;
this->data_image_native_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_));
+ 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_name_ = traits::insert_one_name;
this->insert_one_text_ = traits::insert_one_statement;