If PQexecParams() returns 0 (e.g. for fatal errors like a connection lost),
a call to throw_postgresql_soci_error() with 0 as argument ends in an
assert. So don't call throw_postgresql_soci_error() for such cases but throw
a soci_error("Cannot execute query.").
This patch corrects this for cases where numberOfExecutions is one.Signed-off-by: Alexander Holler <[email protected]> --- src/backends/postgresql/statement.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backends/postgresql/statement.cpp b/src/backends/postgresql/statement.cpp index 9caffe8..857583f 100644 --- a/src/backends/postgresql/statement.cpp +++ b/src/backends/postgresql/statement.cpp @@ -300,14 +300,14 @@ postgresql_statement_backend::execute(int number) #endif // SOCI_POSTGRESQL_NOPARAMS + if (result_ == NULL) + { + throw soci_error("Cannot execute query."); + } + if (numberOfExecutions > 1) { // there are only bulk use elements (no intos) - if (result_ == NULL) - { - throw soci_error("Cannot execute query."); - } - ExecStatusType status = PQresultStatus(result_); if (status != PGRES_COMMAND_OK) { -- 1.7.3.4 ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
