mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
remove the old, bogus error reporting semantics
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4817 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
fe79df9323
commit
2237faa4b5
@ -286,7 +286,6 @@ void
|
||||
xaccAccountCommitEdit (Account *acc)
|
||||
{
|
||||
Backend * be;
|
||||
int rc;
|
||||
|
||||
if (!acc) return;
|
||||
|
||||
@ -342,16 +341,23 @@ xaccAccountCommitEdit (Account *acc)
|
||||
be = xaccAccountGetBackend (acc);
|
||||
if (be && be->account_commit_edit)
|
||||
{
|
||||
rc = (be->account_commit_edit) (be, acc);
|
||||
/* hack alert -- we really really should be checking
|
||||
* for errors returned by the back end ... */
|
||||
if (rc)
|
||||
GNCBackendError errcode;
|
||||
|
||||
/* clear errors */
|
||||
do {
|
||||
errcode = xaccBackendGetError (be);
|
||||
} while (ERR_BACKEND_NO_ERR != errcode);
|
||||
|
||||
(be->account_commit_edit) (be, acc);
|
||||
errcode = xaccBackendGetError (be);
|
||||
|
||||
if (ERR_BACKEND_NO_ERR != errcode)
|
||||
{
|
||||
/* destroys must be rolled back as well ... ??? */
|
||||
acc->do_free = FALSE;
|
||||
/* XXX hack alert FIXME implement account rollback */
|
||||
PERR (" backend asked engine to rollback, but this isn't"
|
||||
" handled yet. Return code=%d", rc);
|
||||
" handled yet. Return code=%d", errcode);
|
||||
}
|
||||
}
|
||||
acc->core_dirty = FALSE;
|
||||
|
@ -50,8 +50,6 @@
|
||||
#include "gnc-book.h"
|
||||
#include "gnc-pricedb.h"
|
||||
|
||||
#define BACKEND_ROLLBACK_DESTROY 999
|
||||
|
||||
/*
|
||||
* The book_begin() routine gives the backend a second initialization
|
||||
* opportunity. It is suggested that the backend check that
|
||||
@ -106,8 +104,8 @@
|
||||
* gives the backend a chance to clean up failed commits.
|
||||
*
|
||||
* If the second user tries to modify a transaction that
|
||||
* the first user deleted, then the backend should return
|
||||
* BACKEND_ROLLBACK_DESTROY from this routine, so that the
|
||||
* the first user deleted, then the backend should set the error
|
||||
* to ERR_BACKEND_MOD_DESTROY from this routine, so that the
|
||||
* engine can properly clean up.
|
||||
*
|
||||
* The run_query() callback takes a GnuCash query object.
|
||||
@ -168,14 +166,14 @@ struct _backend
|
||||
GNCPriceDB * (*price_load) (Backend *);
|
||||
void (*book_end) (Backend *);
|
||||
|
||||
int (*account_begin_edit) (Backend *, Account *);
|
||||
int (*account_commit_edit) (Backend *, Account *);
|
||||
int (*trans_begin_edit) (Backend *, Transaction *);
|
||||
int (*trans_commit_edit) (Backend *, Transaction *new, Transaction *orig);
|
||||
int (*trans_rollback_edit) (Backend *, Transaction *);
|
||||
void (*account_begin_edit) (Backend *, Account *);
|
||||
void (*account_commit_edit) (Backend *, Account *);
|
||||
void (*trans_begin_edit) (Backend *, Transaction *);
|
||||
void (*trans_commit_edit) (Backend *, Transaction *new, Transaction *orig);
|
||||
void (*trans_rollback_edit) (Backend *, Transaction *);
|
||||
|
||||
int (*price_begin_edit) (Backend *, GNCPrice *);
|
||||
int (*price_commit_edit) (Backend *, GNCPrice *);
|
||||
void (*price_begin_edit) (Backend *, GNCPrice *);
|
||||
void (*price_commit_edit) (Backend *, GNCPrice *);
|
||||
|
||||
void (*run_query) (Backend *, Query *);
|
||||
void (*price_lookup) (Backend *, GNCPriceLookup *);
|
||||
|
@ -1449,24 +1449,30 @@ xaccTransCommitEdit (Transaction *trans)
|
||||
be = xaccTransactionGetBackend (trans);
|
||||
if (be && be->trans_commit_edit)
|
||||
{
|
||||
int rc = 0;
|
||||
rc = (be->trans_commit_edit) (be, trans, trans->orig);
|
||||
GNCBackendError errcode;
|
||||
|
||||
if (rc) {
|
||||
/* clear errors */
|
||||
do {
|
||||
errcode = xaccBackendGetError (be);
|
||||
} while (ERR_BACKEND_NO_ERR != errcode);
|
||||
|
||||
(be->trans_commit_edit) (be, trans, trans->orig);
|
||||
|
||||
errcode = xaccBackendGetError (be);
|
||||
if (ERR_BACKEND_NO_ERR != errcode)
|
||||
{
|
||||
/* if the backend puked, then we must roll-back
|
||||
* at this point, and let the user know that we failed.
|
||||
*/
|
||||
/* XXX hack alert -- turn this into a gui dialog */
|
||||
if (ERR_BACKEND_MODIFIED == errcode)
|
||||
{
|
||||
PWARN("Another user has modified this transaction\n"
|
||||
"\tjust a moment ago. Please look at thier changes,\n"
|
||||
"\t and try again, if needed.\n"
|
||||
"\t(This dialog should be a gui dialog and \n"
|
||||
"\tshould check for errors)\n"
|
||||
"\t rc=%d\n", rc);
|
||||
/* hack alert -- we should check for i/o errors from
|
||||
* the backend too ... since an i/o error is not a true
|
||||
* rollback. what to do ...
|
||||
*/
|
||||
"\tshould check for errors)\n");
|
||||
}
|
||||
trans->editlevel++;
|
||||
xaccTransRollbackEdit (trans);
|
||||
return;
|
||||
@ -1670,10 +1676,17 @@ xaccTransRollbackEdit (Transaction *trans)
|
||||
be = xaccTransactionGetBackend (trans);
|
||||
if (be && be->trans_rollback_edit)
|
||||
{
|
||||
int rc = 0;
|
||||
rc = (be->trans_rollback_edit) (be, trans);
|
||||
GNCBackendError errcode;
|
||||
|
||||
if (BACKEND_ROLLBACK_DESTROY == rc)
|
||||
/* clear errors */
|
||||
do {
|
||||
errcode = xaccBackendGetError (be);
|
||||
} while (ERR_BACKEND_NO_ERR != errcode);
|
||||
|
||||
(be->trans_rollback_edit) (be, trans);
|
||||
|
||||
errcode = xaccBackendGetError (be);
|
||||
if (ERR_BACKEND_MOD_DESTROY == errcode)
|
||||
{
|
||||
/* The backend is asking us to delete this transaction.
|
||||
* This typically happens because another (remote) user
|
||||
@ -1686,7 +1699,8 @@ xaccTransRollbackEdit (Transaction *trans)
|
||||
LEAVE ("deleted trans addr=%p\n", trans);
|
||||
return;
|
||||
}
|
||||
if (rc) {
|
||||
if (ERR_BACKEND_NO_ERR != errcode)
|
||||
{
|
||||
PERR ("Rollback Failed. Ouch!");
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,12 @@ gnc_price_commit_edit (GNCPrice *p)
|
||||
Backend *be;
|
||||
be = xaccPriceDBGetBackend (p->db);
|
||||
if (be && be->price_commit_edit) {
|
||||
int rc;
|
||||
GNCBackendError errcode;
|
||||
|
||||
/* clear errors */
|
||||
do {
|
||||
errcode = xaccBackendGetError (be);
|
||||
} while (ERR_BACKEND_NO_ERR != errcode);
|
||||
|
||||
/* if we haven't been able to call begin edit before, call it now */
|
||||
if (TRUE == p->not_saved) {
|
||||
@ -196,11 +201,13 @@ gnc_price_commit_edit (GNCPrice *p)
|
||||
}
|
||||
}
|
||||
|
||||
rc = (be->price_commit_edit) (be, p);
|
||||
if (rc) {
|
||||
(be->price_commit_edit) (be, p);
|
||||
errcode = xaccBackendGetError (be);
|
||||
if (ERR_BACKEND_NO_ERR != errcode)
|
||||
{
|
||||
/* XXX hack alert FIXME implement price rollback */
|
||||
PERR (" backend asked engine to rollback, but this isn't"
|
||||
" handled yet. Return code=%d", rc);
|
||||
" handled yet. Return code=%d", errcode);
|
||||
}
|
||||
}
|
||||
p->not_saved = FALSE;
|
||||
|
@ -418,12 +418,12 @@ static void rpcend_book_end (Backend *bend)
|
||||
LEAVE ("be=%p", be);
|
||||
}
|
||||
|
||||
static int rpcend_account_begin_edit (Backend *bend, Account *acct)
|
||||
static void rpcend_account_begin_edit (Backend *bend, Account *acct)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_backend_guid args;
|
||||
int ret = 0;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
|
||||
ENTER ("be=%p, acc=%p", be, acct);
|
||||
|
||||
@ -432,21 +432,27 @@ static int rpcend_account_begin_edit (Backend *bend, Account *acct)
|
||||
memcpy (args.guid, acct->guid.data, sizeof (args.guid));
|
||||
|
||||
gncrpc_account_begin_edit_1 (&args, &ret, be->client);
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, acc=%p (%s)", be, acct, acct ? acct->accountName : "");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_account_rollback_edit (Backend *bend, Account *acct)
|
||||
static void rpcend_account_rollback_edit (Backend *bend, Account *acct)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_backend_guid args;
|
||||
int ret = 0;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
|
||||
ENTER ("be=%p, acc=%p (%s)", be, acct, acct ? acct->accountName : "");
|
||||
|
||||
if (acct == NULL)
|
||||
return ERR_BACKEND_MISC;
|
||||
if (acct == NULL) {
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
return;
|
||||
}
|
||||
|
||||
memset (&args, 0, sizeof (args));
|
||||
memcpy (args.backend, (char *)&be, sizeof(be));
|
||||
@ -454,22 +460,28 @@ static int rpcend_account_rollback_edit (Backend *bend, Account *acct)
|
||||
|
||||
gncrpc_account_rollback_edit_1 (&args, &ret, be->client);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, acc=%p, ret=%d", be, acct, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_account_commit_edit (Backend *bend, Account *acct)
|
||||
static void rpcend_account_commit_edit (Backend *bend, Account *acct)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_commit_acct_args args;
|
||||
int ret = 0;
|
||||
AccountGroup *parent;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
|
||||
ENTER ("be=%p, acc=%p (%s)", be, acct, acct ? acct->accountName : "");
|
||||
|
||||
if (acct == NULL)
|
||||
return ERR_BACKEND_MISC;
|
||||
if (acct == NULL) {
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
return;
|
||||
}
|
||||
|
||||
parent = xaccAccountGetParent(acct);
|
||||
|
||||
@ -507,16 +519,20 @@ static int rpcend_account_commit_edit (Backend *bend, Account *acct)
|
||||
acct->version--;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, acc=%p, ret=%d", be, acct, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_trans_begin_edit (Backend *bend, Transaction *txn)
|
||||
static void rpcend_trans_begin_edit (Backend *bend, Transaction *txn)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_backend_guid args;
|
||||
int ret = 0;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
|
||||
ENTER ("be=%p, txn=%p", be, txn);
|
||||
|
||||
@ -525,17 +541,21 @@ static int rpcend_trans_begin_edit (Backend *bend, Transaction *txn)
|
||||
memcpy (args.guid, txn->guid.data, sizeof (args.guid));
|
||||
|
||||
gncrpc_txn_begin_edit_1 (&args, &ret, be->client);
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, txn=%p", be, txn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_trans_commit_edit (Backend *bend, Transaction *new,
|
||||
static void rpcend_trans_commit_edit (Backend *bend, Transaction *new,
|
||||
Transaction *orig)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_commit_txn_args args;
|
||||
int ret = 0;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
ENTER ("be=%p, new=%p, vers=%d", be, new, new->version);
|
||||
|
||||
new->version++;
|
||||
@ -553,16 +573,20 @@ static int rpcend_trans_commit_edit (Backend *bend, Transaction *new,
|
||||
new->version--;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, new=%p, ret=%d, txn_vers=%d", be, new, ret, new->version);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_trans_rollback_edit (Backend *bend, Transaction *txn)
|
||||
static void rpcend_trans_rollback_edit (Backend *bend, Transaction *txn)
|
||||
{
|
||||
RPCBackend *be = (RPCBackend *)bend;
|
||||
gncrpc_backend_guid args;
|
||||
int ret = 0;
|
||||
VERIFY_BE (be, -1);
|
||||
VERIFY_BEV (be);
|
||||
ENTER ("be=%p, txn=%p", be, txn);
|
||||
memset (&args, 0, sizeof (args));
|
||||
memcpy (args.backend, (char *)&be, sizeof(be));
|
||||
@ -570,20 +594,22 @@ static int rpcend_trans_rollback_edit (Backend *bend, Transaction *txn)
|
||||
|
||||
gncrpc_txn_rollback_edit_1 (&args, &ret, be->client);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* ah this is certainly wrong ... */
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MISC);
|
||||
}
|
||||
LEAVE ("be=%p, txn=%p, ret=%d", be, txn, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rpcend_price_begin_edit (Backend *bend, GNCPrice *pr)
|
||||
static void rpcend_price_begin_edit (Backend *bend, GNCPrice *pr)
|
||||
{
|
||||
PERR ("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rpcend_price_commit_edit (Backend *bend, GNCPrice *pr)
|
||||
static void rpcend_price_commit_edit (Backend *bend, GNCPrice *pr)
|
||||
{
|
||||
PERR ("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rpcend_price_lookup (Backend *bend, GNCPriceLookup *q)
|
||||
|
@ -444,7 +444,7 @@ pgendCopyAccountToEngine (PGBackend *be, const GUID *acct_guid)
|
||||
/* ============================================================= */
|
||||
/* ============================================================= */
|
||||
|
||||
int
|
||||
void
|
||||
pgend_account_commit_edit (Backend * bend,
|
||||
Account * acct)
|
||||
{
|
||||
@ -453,7 +453,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
PGBackend *be = (PGBackend *)bend;
|
||||
|
||||
ENTER ("be=%p, acct=%p", be, acct);
|
||||
if (!be || !acct) return 1; /* hack alert hardcode literal */
|
||||
if (!be || !acct) return;
|
||||
|
||||
if (FALSE == acct->core_dirty)
|
||||
{
|
||||
@ -468,7 +468,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
"LOCK TABLE gncAccount IN EXCLUSIVE MODE;\n"
|
||||
"LOCK TABLE gncCommodity IN EXCLUSIVE MODE;\n";
|
||||
|
||||
SEND_QUERY (be,p, 555);
|
||||
SEND_QUERY (be,p,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* check to see that the engine version is equal or newer than
|
||||
@ -478,7 +478,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
{
|
||||
acct->do_free = FALSE;
|
||||
p = "ROLLBACK;";
|
||||
SEND_QUERY (be,p,444);
|
||||
SEND_QUERY (be,p,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* hack alert -- we should restore the account data from the
|
||||
@ -488,7 +488,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
" is not completely implemented !! \n");
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MODIFIED);
|
||||
LEAVE ("rolled back");
|
||||
return 445;
|
||||
return;
|
||||
}
|
||||
acct->version ++; /* be sure to update the version !! */
|
||||
acct->version_check = be->version_check;
|
||||
@ -503,7 +503,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
p = stpcpy (p, "DELETE FROM gncAccount WHERE accountGuid='");
|
||||
p = guid_to_string_buff (guid, p);
|
||||
p = stpcpy (p, "';");
|
||||
SEND_QUERY (be,be->buff, 444);
|
||||
SEND_QUERY (be,be->buff,);
|
||||
FINISH_QUERY(be->connection);
|
||||
}
|
||||
else
|
||||
@ -513,7 +513,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
|
||||
p = "COMMIT;\n"
|
||||
"NOTIFY gncAccount;";
|
||||
SEND_QUERY (be,p,336);
|
||||
SEND_QUERY (be,p,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* Mark this up so that we don't get that annoying gui dialog
|
||||
@ -524,7 +524,7 @@ pgend_account_commit_edit (Backend * bend,
|
||||
parent = xaccAccountGetParent(acct);
|
||||
if (parent) parent->saved = 1;
|
||||
LEAVE ("commited");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ======================== END OF FILE ======================== */
|
||||
|
@ -35,6 +35,6 @@ void pgendStoreGroupNoLock (PGBackend *be, AccountGroup *grp,
|
||||
gboolean do_mark, gboolean do_check_version);
|
||||
int pgendCopyAccountToEngine (PGBackend *be, const GUID *acct_guid);
|
||||
|
||||
int pgend_account_commit_edit (Backend * bend, Account * acct);
|
||||
void pgend_account_commit_edit (Backend * bend, Account * acct);
|
||||
|
||||
#endif /* __POSTGRES_ACCOUNT_H__ */
|
||||
|
@ -400,29 +400,29 @@ pgendPriceLookup (Backend *bend, GNCPriceLookup *look)
|
||||
/* ============================================================= */
|
||||
/* ============================================================= */
|
||||
|
||||
int
|
||||
void
|
||||
pgend_price_begin_edit (Backend * bend, GNCPrice *pr)
|
||||
{
|
||||
if (pr && pr->db && pr->db->dirty)
|
||||
{
|
||||
PERR ("price db is unexpectedly dirty");
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
pgend_price_commit_edit (Backend * bend, GNCPrice *pr)
|
||||
{
|
||||
char * bufp;
|
||||
PGBackend *be = (PGBackend *)bend;
|
||||
|
||||
ENTER ("be=%p, price=%p", be, pr);
|
||||
if (!be || !pr) return 1; /* hack alert hardcode literal */
|
||||
if (!be || !pr) return;
|
||||
|
||||
/* lock it up so that we query and store atomically */
|
||||
bufp = "BEGIN;\n"
|
||||
"LOCK TABLE gncPrice IN EXCLUSIVE MODE;\n";
|
||||
SEND_QUERY (be,bufp, 555);
|
||||
SEND_QUERY (be,bufp,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* check to see that the engine version is equal or newer than
|
||||
@ -432,7 +432,7 @@ pgend_price_commit_edit (Backend * bend, GNCPrice *pr)
|
||||
{
|
||||
pr->do_free = FALSE;
|
||||
bufp = "ROLLBACK;";
|
||||
SEND_QUERY (be,bufp,444);
|
||||
SEND_QUERY (be,bufp,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* hack alert -- we should restore the price data from the
|
||||
@ -441,7 +441,8 @@ pgend_price_commit_edit (Backend * bend, GNCPrice *pr)
|
||||
" price must be rolled back. This function\n"
|
||||
" is not completely implemented !! \n");
|
||||
LEAVE ("rolled back");
|
||||
return 445;
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MODIFIED);
|
||||
return;
|
||||
}
|
||||
pr->version ++; /* be sure to update the version !! */
|
||||
pr->version_check = be->version_check;
|
||||
@ -454,7 +455,7 @@ pgend_price_commit_edit (Backend * bend, GNCPrice *pr)
|
||||
bufp = guid_to_string_buff (gnc_price_get_guid(pr), bufp);
|
||||
bufp = stpcpy (bufp, "';");
|
||||
PINFO ("%s\n", be->buff ? be->buff : "(null)");
|
||||
SEND_QUERY (be,be->buff, 444);
|
||||
SEND_QUERY (be,be->buff, );
|
||||
FINISH_QUERY(be->connection);
|
||||
}
|
||||
else
|
||||
@ -464,13 +465,13 @@ pgend_price_commit_edit (Backend * bend, GNCPrice *pr)
|
||||
|
||||
bufp = "COMMIT;\n"
|
||||
"NOTIFY gncPrice;";
|
||||
SEND_QUERY (be,bufp,335);
|
||||
SEND_QUERY (be,bufp,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
if (pr->db) pr->db->dirty = FALSE;
|
||||
|
||||
LEAVE ("commited");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ======================== END OF FILE ======================== */
|
||||
|
@ -33,7 +33,7 @@ GNCPriceDB * pgendGetAllPrices (PGBackend *be, GNCPriceDB *prdb);
|
||||
void pgendPriceLookup (Backend *bend, GNCPriceLookup *look);
|
||||
|
||||
|
||||
int pgend_price_begin_edit (Backend * bend, GNCPrice *pr);
|
||||
int pgend_price_commit_edit (Backend * bend, GNCPrice *pr);
|
||||
void pgend_price_begin_edit (Backend * bend, GNCPrice *pr);
|
||||
void pgend_price_commit_edit (Backend * bend, GNCPrice *pr);
|
||||
|
||||
#endif /* __POSTGRES_PRICE_H__ */
|
||||
|
@ -732,7 +732,7 @@ pgendSyncTransaction (PGBackend *be, GUID *trans_guid)
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
int
|
||||
void
|
||||
pgend_trans_commit_edit (Backend * bend,
|
||||
Transaction * trans,
|
||||
Transaction * oldtrans)
|
||||
@ -742,13 +742,13 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
PGBackend *be = (PGBackend *)bend;
|
||||
|
||||
ENTER ("be=%p, trans=%p", be, trans);
|
||||
if (!be || !trans) return 1; /* hack alert hardcode literal */
|
||||
if (!be || !trans) return;
|
||||
|
||||
/* lock it up so that we query and store atomically */
|
||||
bufp = "BEGIN;\n"
|
||||
"LOCK TABLE gncTransaction IN EXCLUSIVE MODE;\n"
|
||||
"LOCK TABLE gncEntry IN EXCLUSIVE MODE;\n";
|
||||
SEND_QUERY (be,bufp, 555);
|
||||
SEND_QUERY (be,bufp, );
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* Check to see if this is a 'new' transaction, or not.
|
||||
@ -822,7 +822,7 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
|
||||
if (rollback) {
|
||||
bufp = "ROLLBACK;";
|
||||
SEND_QUERY (be,bufp,444); /* hack alert hard coded literal */
|
||||
SEND_QUERY (be,bufp,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
PINFO ("old tranasction didn't match DB, edit rolled back)\n");
|
||||
@ -834,7 +834,7 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
* the sql database, and voila! we are good to go.
|
||||
*/
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MODIFIED);
|
||||
return 666; /* hack alert- hard coded literal */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
|
||||
bufp = "COMMIT;\n"
|
||||
"NOTIFY gncTransaction;";
|
||||
SEND_QUERY (be,bufp,334);
|
||||
SEND_QUERY (be,bufp,);
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
/* If this is the multi-user mode, we need to update the
|
||||
@ -879,7 +879,7 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
}
|
||||
|
||||
LEAVE ("commited");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ============================================================= */
|
||||
@ -894,13 +894,13 @@ pgend_trans_commit_edit (Backend * bend,
|
||||
* to sync from the changes that other users had made.
|
||||
*/
|
||||
|
||||
int
|
||||
void
|
||||
pgend_trans_rollback_edit (Backend * bend, Transaction * trans)
|
||||
{
|
||||
PGBackend *be = (PGBackend *)bend;
|
||||
const GUID * trans_guid;
|
||||
|
||||
if (!be || !trans) return 0;
|
||||
if (!be || !trans) return;
|
||||
ENTER ("be=%p, trans=%p", be, trans);
|
||||
|
||||
/* First, lets see if the other user had deleted this transaction.
|
||||
@ -910,14 +910,14 @@ pgend_trans_rollback_edit (Backend * bend, Transaction * trans)
|
||||
{
|
||||
LEAVE ("destroyed");
|
||||
xaccBackendSetError (&be->be, ERR_BACKEND_MOD_DESTROY);
|
||||
return BACKEND_ROLLBACK_DESTROY;
|
||||
return;
|
||||
}
|
||||
|
||||
trans_guid = xaccTransGetGUID (trans);
|
||||
pgendCopyTransactionToEngine (be, trans_guid);
|
||||
|
||||
LEAVE ("rolled back");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ======================== END OF FILE ======================== */
|
||||
|
@ -46,8 +46,8 @@ int pgendCopyTransactionToEngine (PGBackend *be, const GUID *trans_guid);
|
||||
void pgendStoreAllTransactions (PGBackend *be, AccountGroup *grp);
|
||||
void pgendStoreTransactionNoLock (PGBackend *be, Transaction *trans, gboolean do_check_version);
|
||||
|
||||
int pgend_trans_commit_edit (Backend * bend, Transaction * trans, Transaction * oldtrans);
|
||||
int pgend_trans_rollback_edit (Backend * bend, Transaction * trans);
|
||||
void pgend_trans_commit_edit (Backend * bend, Transaction * trans, Transaction * oldtrans);
|
||||
void pgend_trans_rollback_edit (Backend * bend, Transaction * trans);
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user