aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-20 06:48:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-20 06:48:28 +0200
commit8fceda2b30ecfa4458159e3c765e0aac7004f2f6 (patch)
treefc35dedf7e5bc5cfc1bc8e7458d986d7d8802c97
parente85b07722107d00e4a3182ff4d33274a617bb55a (diff)
parent19ba3497c0788f02fc417f441d87c96ce23f9446 (diff)
Merge branch 'master' into bulk
-rw-r--r--odb/relational/header.cxx13
-rw-r--r--odb/relational/source.cxx84
-rw-r--r--odb/relational/validator.cxx19
-rw-r--r--odb/validator.cxx15
-rw-r--r--odb/version.hxx8
-rw-r--r--version2
6 files changed, 79 insertions, 62 deletions
diff --git a/odb/relational/header.cxx b/odb/relational/header.cxx
index 6584b8e..e8cba05 100644
--- a/odb/relational/header.cxx
+++ b/odb/relational/header.cxx
@@ -779,6 +779,7 @@ traverse_view (type& c)
bool versioned (context::versioned (c));
string const& type (class_fq_name (c));
+ size_t columns (column_count (c).total);
size_t obj_count (c.get<size_t> ("object-count"));
os << "// " << class_name (c) << endl
@@ -856,8 +857,7 @@ traverse_view (type& c)
os << "," << endl
<< "const schema_version_migration&";
- os << ");"
- << endl;
+ os << ")" << (columns != 0 ? ";\n" : "{}");
}
// bind (image_type)
@@ -870,8 +870,7 @@ traverse_view (type& c)
os << "," << endl
<< "const schema_version_migration&";
- os << ");"
- << endl;
+ os << ")" << (columns != 0 ? ";\n" : "{}");
// init (view, image)
//
@@ -884,13 +883,11 @@ traverse_view (type& c)
os << "," << endl
<< "const schema_version_migration&";
- os << ");"
- << endl;
+ os << ")" << (columns != 0 ? ";\n" : "{}");
// column_count
//
- os << "static const std::size_t column_count = " <<
- column_count (c).total << "UL;"
+ os << "static const std::size_t column_count = " << columns << "UL;"
<< endl;
// Statements.
diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx
index 43d347c..6c8204c 100644
--- a/odb/relational/source.cxx
+++ b/odb/relational/source.cxx
@@ -4559,6 +4559,8 @@ traverse_view (type& c)
string traits ("access::view_traits_impl< " + type + ", id_" +
db.string () + " >");
+ size_t columns (column_count (c).total);
+
// Schema name as a string literal or empty.
//
string schema_name (options.schema_name ()[db]);
@@ -4582,7 +4584,7 @@ traverse_view (type& c)
// grow ()
//
- if (generate_grow)
+ if (generate_grow && columns != 0)
{
os << "bool " << traits << "::" << endl
<< "grow (image_type& i," << endl
@@ -4613,58 +4615,64 @@ traverse_view (type& c)
// bind (image_type)
//
- os << "void " << traits << "::" << endl
- << "bind (" << bind_vector << " b," << endl
- << "image_type& i";
+ if (columns != 0)
+ {
+ os << "void " << traits << "::" << endl
+ << "bind (" << bind_vector << " b," << endl
+ << "image_type& i";
- if (versioned)
- os << "," << endl
- << "const schema_version_migration& svm";
+ if (versioned)
+ os << "," << endl
+ << "const schema_version_migration& svm";
- os << ")"
- << "{";
+ os << ")"
+ << "{";
- if (versioned)
- os << "ODB_POTENTIALLY_UNUSED (svm);"
- << endl;
+ if (versioned)
+ os << "ODB_POTENTIALLY_UNUSED (svm);"
+ << endl;
- os << "using namespace " << db << ";"
- << endl
- << db << "::statement_kind sk (statement_select);"
- << "ODB_POTENTIALLY_UNUSED (sk);"
- << endl
- << "std::size_t n (0);"
- << endl;
+ os << "using namespace " << db << ";"
+ << endl
+ << db << "::statement_kind sk (statement_select);"
+ << "ODB_POTENTIALLY_UNUSED (sk);"
+ << endl
+ << "std::size_t n (0);"
+ << endl;
- names (c, bind_member_names_);
+ names (c, bind_member_names_);
- os << "}";
+ os << "}";
+ }
// init (view, image)
//
- os << "void " << traits << "::" << endl
- << "init (view_type& o," << endl
- << "const image_type& i," << endl
- << "database* db";
+ if (columns != 0)
+ {
+ os << "void " << traits << "::" << endl
+ << "init (view_type& o," << endl
+ << "const image_type& i," << endl
+ << "database* db";
- if (versioned)
- os << "," << endl
- << "const schema_version_migration& svm";
+ if (versioned)
+ os << "," << endl
+ << "const schema_version_migration& svm";
- os << ")"
- << "{"
- << "ODB_POTENTIALLY_UNUSED (o);"
- << "ODB_POTENTIALLY_UNUSED (i);"
- << "ODB_POTENTIALLY_UNUSED (db);";
+ os << ")"
+ << "{"
+ << "ODB_POTENTIALLY_UNUSED (o);"
+ << "ODB_POTENTIALLY_UNUSED (i);"
+ << "ODB_POTENTIALLY_UNUSED (db);";
- if (versioned)
- os << "ODB_POTENTIALLY_UNUSED (svm);";
+ if (versioned)
+ os << "ODB_POTENTIALLY_UNUSED (svm);";
- os << endl;
+ os << endl;
- names (c, init_value_member_names_);
+ names (c, init_value_member_names_);
- os << "}";
+ os << "}";
+ }
// query_statement()
//
diff --git a/odb/relational/validator.cxx b/odb/relational/validator.cxx
index f204a6d..6c3a6fd 100644
--- a/odb/relational/validator.cxx
+++ b/odb/relational/validator.cxx
@@ -491,11 +491,30 @@ namespace relational
virtual void
traverse_view (type& c)
{
+ const view_query& vq (c.get<view_query> ("query"));
+
// Make sure we don't have any containers or object pointers.
//
view_members_.traverse (c);
names (c, data_member_names_);
+
+ // Allow certain kinds of empty views.
+ //
+ if (vq.kind != view_query::runtime &&
+ vq.kind != view_query::complete_execute)
+ {
+ // Allow all the members to be deleted.
+ //
+ column_count_type const& cc (column_count (c));
+
+ if (cc.total == 0)
+ {
+ os << c.file () << ":" << c.line () << ":" << c.column () << ":"
+ << " error: no persistent data members in the class" << endl;
+ valid_ = false;
+ }
+ }
}
virtual void
diff --git a/odb/validator.cxx b/odb/validator.cxx
index f8f7408..4bd4c95 100644
--- a/odb/validator.cxx
+++ b/odb/validator.cxx
@@ -1423,18 +1423,11 @@ namespace
}
virtual void
- traverse_view (type& c)
+ traverse_view (type&)
{
- // Allow all the members to be deleted.
- //
- column_count_type const& cc (column_count (c));
-
- if (cc.total == 0)
- {
- os << c.file () << ":" << c.line () << ":" << c.column () << ":"
- << " error: no persistent data members in the class" << endl;
- valid_ = false;
- }
+ // We don't check for the column count here since we may want to
+ // allow certain kinds of empty views. Instead, this is handled
+ // in relational::validation.
}
virtual void
diff --git a/odb/version.hxx b/odb/version.hxx
index 90003e9..ac831c1 100644
--- a/odb/version.hxx
+++ b/odb/version.hxx
@@ -24,12 +24,12 @@
// ODB interface version: minor, major, and alpha/beta versions.
//
-#define ODB_VERSION 20303
-#define ODB_VERSION_STR "2.4.a3"
+#define ODB_VERSION 20304
+#define ODB_VERSION_STR "2.4.a4"
// ODB compiler version: interface version plus the bugfix version.
//
-#define ODB_COMPILER_VERSION 2039903
-#define ODB_COMPILER_VERSION_STR "2.4.0.a3"
+#define ODB_COMPILER_VERSION 2039904
+#define ODB_COMPILER_VERSION_STR "2.4.0.a4"
#endif // ODB_VERSION_HXX
diff --git a/version b/version
index 26d9ac3..42645da 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-2.4.0.a3
+2.4.0.a4