diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-03 12:49:14 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-03 12:49:14 +0200 |
commit | 3b9fabfc20089fe9e9279a287c1db5bb37a6d275 (patch) | |
tree | 36d694072d10d9d95d0c24ed18fbda3029d79601 | |
parent | 9715f388db714fb663b854883e4cad5f2aa3c860 (diff) |
Handling of dynamic empty statements as result of versioning
-rw-r--r-- | odb/pgsql/statement.cxx | 6 | ||||
-rw-r--r-- | odb/pgsql/statement.hxx | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx index b65eb5b..eea3c39 100644 --- a/odb/pgsql/statement.cxx +++ b/odb/pgsql/statement.cxx @@ -187,6 +187,12 @@ namespace odb text_ = text_copy_.c_str (); } + if (empty ()) + { + deallocated_ = true; + return; + } + { odb::tracer* t; if ((t = conn_.transaction_tracer ()) || diff --git a/odb/pgsql/statement.hxx b/odb/pgsql/statement.hxx index 4cc1f42..6c6095c 100644 --- a/odb/pgsql/statement.hxx +++ b/odb/pgsql/statement.hxx @@ -50,6 +50,17 @@ namespace odb return conn_; } + // A statement can be empty. This is used to handle situations + // where a SELECT or UPDATE statement ends up not having any + // columns after processing. An empty statement cannot be + // executed. + // + bool + empty () const + { + return *text_ == '\0'; + } + void deallocate (); |