aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/pgsql
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-22 11:47:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-22 11:47:55 +0200
commitb79afa6dbea19905b2a035365274616dd1dae2b1 (patch)
tree428110d79f2dfdeaef4405c5b27cd2fdd1ab969b /odb/relational/pgsql
parent3e57c662b42831555498607d607c349f30c5b7de (diff)
Add database::erase_query() function
New test: common/erase-query. Documentation is in Section 3.9, "Deleting Persistent Objects". The current implementation does not work well with the session (no removal of the erased objects from the cache).
Diffstat (limited to 'odb/relational/pgsql')
-rw-r--r--odb/relational/pgsql/header.cxx3
-rw-r--r--odb/relational/pgsql/source.cxx28
2 files changed, 22 insertions, 9 deletions
diff --git a/odb/relational/pgsql/header.cxx b/odb/relational/pgsql/header.cxx
index 64b02d8..edf9355 100644
--- a/odb/relational/pgsql/header.cxx
+++ b/odb/relational/pgsql/header.cxx
@@ -36,7 +36,8 @@ namespace relational
// Query statement name.
//
if (options.generate_query ())
- os << "static const char* const query_statement_name;";
+ os << "static const char* const query_statement_name;"
+ << "static const char* const erase_query_statement_name;";
os << endl;
diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx
index 83aa8c4..bfc26ba 100644
--- a/odb/relational/pgsql/source.cxx
+++ b/odb/relational/pgsql/source.cxx
@@ -873,6 +873,10 @@ namespace relational
{
os << name_decl << endl
<< "query_statement_name = " << strlit (fn + "_query") << ";"
+ << endl
+ << name_decl << endl
+ << "erase_query_statement_name = " <<
+ strlit (fn + "_erase_query") << ";"
<< endl;
}
@@ -936,21 +940,29 @@ namespace relational
}
virtual void
- query_statement_ctor (type& c)
+ query_statement_ctor_args (type&)
{
- string const& type (c.fq_name ());
- string traits ("access::object_traits< " + type + " >");
-
- os << "select_statement (" << endl
- << "sts.connection ()," << endl
+ os << "sts.connection ()," << endl
<< "query_statement_name," << endl
- << "query_clause + q.clause ()," << endl
+ << "query_clause + q.clause (table_name)," << endl
<< "q.parameter_types ()," << endl
<< "q.parameter_count ()," << endl
<< "q.parameters_binding ()," << endl
- << "imb)";
+ << "imb";
+ }
+
+ virtual void
+ erase_query_statement_ctor_args (type&)
+ {
+ os << "conn," << endl
+ << "erase_query_statement_name," << endl
+ << "erase_query_clause + q.clause (table_name)," << endl
+ << "q.parameter_types ()," << endl
+ << "q.parameter_count ()," << endl
+ << "q.parameters_binding ()";
}
+
virtual void
post_query_ (type&)
{