From abc21c5fe4d7000c6875b49c48af10fd0826d05c Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 10 Jun 2001 23:11:57 +0000 Subject: [PATCH] bug fix git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4596 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/sql/txn.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/engine/sql/txn.c b/src/engine/sql/txn.c index 69dbc163f3..484893b61b 100644 --- a/src/engine/sql/txn.c +++ b/src/engine/sql/txn.c @@ -390,6 +390,18 @@ pgendCopyTransactionToEngine (PGBackend *be, const GUID *trans_guid) i, nrows, ncols); j = 0; + if (0 == nrows) + { + PQclear (result); + /* I beleive its a programming error to get this case. + * Print a warning for now... */ + PERR ("no such transaction in the database. This is unexpected ...\n"); + xaccBackendSetError (&be->be, ERR_SQL_MISSING_DATA); + pgendEnable(be); + gnc_engine_resume_events(); + return 0; + } + if (1 < nrows) { /* since the guid is primary key, this error is totally @@ -458,17 +470,6 @@ pgendCopyTransactionToEngine (PGBackend *be, const GUID *trans_guid) i++; } while (result); - if (0 == nrows) - { - /* hack alert -- not sure how to handle this case; we'll just - * punt for now ... */ - PERR ("no such transaction in the database. This is unexpected ...\n"); - xaccBackendSetError (&be->be, ERR_SQL_MISSING_DATA); - pgendEnable(be); - gnc_engine_resume_events(); - return 0; - } - /* if engine data was newer, we are done */ if (0 <= engine_data_is_newer) {