r16042 - gnucash/trunk - Collapse the various "idata" fields into a single field attached to
David Hampton
hampton at cvs.gnucash.org
Wed May 2 23:56:34 EDT 2007
Author: hampton
Date: 2007-05-02 23:56:31 -0400 (Wed, 02 May 2007)
New Revision: 16042
Trac: http://svn.gnucash.org/trac/changeset/16042
Modified:
gnucash/trunk/lib/libqof/qof/qofbackend-p.h
gnucash/trunk/lib/libqof/qof/qofbook.c
gnucash/trunk/lib/libqof/qof/qofbook.h
gnucash/trunk/lib/libqof/qof/qofinstance.c
gnucash/trunk/lib/libqof/qof/qofinstance.h
gnucash/trunk/src/backend/postgres/PostgresBackend.c
gnucash/trunk/src/backend/postgres/account.c
gnucash/trunk/src/backend/postgres/book.c
gnucash/trunk/src/backend/postgres/table.m4
gnucash/trunk/src/backend/postgres/txn.c
gnucash/trunk/src/backend/postgres/txnmass.c
gnucash/trunk/src/engine/Account.c
gnucash/trunk/src/engine/AccountP.h
gnucash/trunk/src/engine/Split.c
gnucash/trunk/src/engine/SplitP.h
gnucash/trunk/src/engine/Transaction.c
gnucash/trunk/src/engine/TransactionP.h
Log:
Collapse the various "idata" fields into a single field attached to
the QofInstance object.
Modified: gnucash/trunk/lib/libqof/qof/qofbackend-p.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend-p.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/lib/libqof/qof/qofbackend-p.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -393,16 +393,8 @@
*/
gint32 qof_book_get_version (const QofBook *book);
-/** get the book tag number
-
-used for kvp management in sql backends.
-*/
-guint32 qof_book_get_idata (const QofBook *book);
-
void qof_book_set_version (QofBook *book, gint32 version);
-void qof_book_set_idata(QofBook *book, guint32 idata);
-
/* @} */
/* @} */
/* @} */
Modified: gnucash/trunk/lib/libqof/qof/qofbook.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbook.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/lib/libqof/qof/qofbook.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -76,7 +76,6 @@
book->book_open = 'y';
book->version = 0;
- book->idata = 0;
}
QofBook *
@@ -357,24 +356,12 @@
return book->version;
}
-guint32 qof_book_get_idata (const QofBook *book)
-{
- if(!book) { return 0; }
- return book->idata;
-}
-
void qof_book_set_version (QofBook *book, gint32 version)
{
if(!book && version < 0) { return; }
book->version = version;
}
-void qof_book_set_idata(QofBook *book, guint32 idata)
-{
- if(!book && idata < 0) { return; }
- book->idata = idata;
-}
-
gint64
qof_book_get_counter (QofBook *book, const char *counter_name)
{
Modified: gnucash/trunk/lib/libqof/qof/qofbook.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbook.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/lib/libqof/qof/qofbook.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -114,10 +114,6 @@
* except that it provides a nice convenience, avoiding a lookup
* from the session. Better solutions welcome ... */
QofBackend *backend;
-
- /* -------------------------------------------------------------- */
- /* Backend private expansion data */
- guint32 idata; /* used by the sql backend for kvp management */
};
struct _QofBookClass
Modified: gnucash/trunk/lib/libqof/qof/qofinstance.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofinstance.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/lib/libqof/qof/qofinstance.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -56,8 +56,10 @@
PROP_DESTROYING,
PROP_DIRTY,
PROP_INFANT,
+
PROP_VERSION,
PROP_VERSION_CHECK,
+ PROP_IDATA,
};
typedef struct QofInstancePrivate
@@ -101,6 +103,9 @@
gint32 version;
guint32 version_check; /* data aging timestamp */
+ /* -------------------------------------------------------------- */
+ /* Backend private expansion data */
+ guint32 idata; /* used by the sql backend for kvp management */
} QofInstancePrivate;
#define GET_PRIVATE(o) \
@@ -183,7 +188,7 @@
g_param_spec_int ("editlevel",
"Object Edit Level",
"The object edit level.",
- 0, G_MAXINT, 0,
+ 0, G_MAXINT32, 0,
G_PARAM_READABLE));
g_object_class_install_property
@@ -240,6 +245,15 @@
G_MAXUINT32,
0,
G_PARAM_READWRITE));
+
+ g_object_class_install_property
+ (object_class,
+ PROP_EDITLEVEL,
+ g_param_spec_uint ("idata",
+ "Object IData",
+ "Per instance backend private data.",
+ 0, G_MAXUINT32, 0,
+ G_PARAM_READWRITE));
}
static void
@@ -378,6 +392,9 @@
case PROP_VERSION_CHECK:
g_value_set_uint(value, priv->version_check);
break;
+ case PROP_IDATA:
+ g_value_set_uint(value, priv->idata);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -428,6 +445,9 @@
case PROP_VERSION_CHECK:
qof_instance_set_version_check(inst, g_value_get_uint(value));
break;
+ case PROP_IDATA:
+ qof_instance_set_idata(inst, g_value_get_uint(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -780,6 +800,21 @@
GET_PRIVATE(to)->version_check = GET_PRIVATE(from)->version_check;
}
+guint32 qof_instance_get_idata (gconstpointer inst)
+{
+ if(!inst) { return 0; }
+ g_return_val_if_fail(QOF_IS_INSTANCE(inst), 0);
+ return GET_PRIVATE(inst)->idata;
+}
+
+void qof_instance_set_idata(gpointer inst, guint32 idata)
+{
+ if(!inst) { return; }
+ if(idata < 0) { return; }
+ g_return_if_fail(QOF_IS_INSTANCE(inst));
+ GET_PRIVATE(inst)->idata = idata;
+}
+
/* ========================================================== */
void
Modified: gnucash/trunk/lib/libqof/qof/qofinstance.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofinstance.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/lib/libqof/qof/qofinstance.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -218,6 +218,11 @@
/** copy the instance version_check number */
void qof_instance_copy_version_check (gpointer to, gconstpointer from);
+/** get the instance tag number
+ used for kvp management in sql backends. */
+guint32 qof_instance_get_idata (gconstpointer inst);
+void qof_instance_set_idata(gpointer inst, guint32 idata);
+
/** Pair things up. This routine inserts a kvp value into each instance
* containing the guid of the other. In this way, if one has one of the
* pair, one can always find the other by looking up it's guid. Typically,
Modified: gnucash/trunk/src/backend/postgres/PostgresBackend.c
===================================================================
--- gnucash/trunk/src/backend/postgres/PostgresBackend.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/PostgresBackend.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -466,7 +466,7 @@
ts = gnc_iso8601_to_timespec_gmt (DB_GET_VAL("date_entered",j));
xaccTransSetDateEnteredTS (trans, &ts);
qof_instance_set_version (trans, atoi(DB_GET_VAL("version",j)));
- trans->idata = atoi(DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(trans, atoi(DB_GET_VAL("iguid",j)));
currency = gnc_string_to_commodity (DB_GET_VAL("currency",j),
pgendGetBook(be));
@@ -564,13 +564,15 @@
Transaction *trans = (Transaction *) node->data;
GList *engine_splits, *snode;
- trans->inst.kvp_data = pgendKVPFetch (be, trans->idata, trans->inst.kvp_data);
+ trans->inst.kvp_data = pgendKVPFetch(be, qof_instance_get_idata(trans),
+ trans->inst.kvp_data);
engine_splits = xaccTransGetSplitList(trans);
for (snode = engine_splits; snode; snode=snode->next)
{
Split *s = snode->data;
- s->inst.kvp_data = pgendKVPFetch (be, s->idata, s->inst.kvp_data);
+ s->inst.kvp_data = pgendKVPFetch(be, qof_instance_get_idata(s),
+ s->inst.kvp_data);
}
xaccTransCommitEdit (trans);
Modified: gnucash/trunk/src/backend/postgres/account.c
===================================================================
--- gnucash/trunk/src/backend/postgres/account.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/account.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -79,6 +79,7 @@
gboolean do_check_version)
{
const gnc_commodity *com;
+ guint32 a_idata;
if (!be || !acct) return;
if ((FALSE == do_mark) && (!qof_instance_get_dirty_flag(acct)))
@@ -105,10 +106,12 @@
/* be sure to update the version !! */
qof_instance_increment_version(acct, be->version_check);
- if ((0 == acct->idata) &&
+ a_idata = qof_instance_get_idata(acct);
+ if ((0 == a_idata) &&
(FALSE == kvp_frame_is_empty (xaccAccountGetSlots(acct))))
{
- acct->idata = pgendNewGUIDidx(be);
+ a_idata = pgendNewGUIDidx(be);
+ qof_instance_set_idata(acct, a_idata);
}
pgendPutOneAccountOnly (be, acct);
@@ -126,10 +129,10 @@
com = xaccAccountGetCommodity (acct);
pgendPutOneCommodityOnly (be, (gnc_commodity *) com);
- if (acct->idata)
+ if (a_idata)
{
- pgendKVPDelete (be, acct->idata);
- pgendKVPStore (be, acct->idata, acct->inst.kvp_data);
+ pgendKVPDelete (be, a_idata);
+ pgendKVPStore (be, a_idata, acct->inst.kvp_data);
}
LEAVE(" ");
}
@@ -208,8 +211,9 @@
restore_cb (Account *acc, void * cb_data)
{
PGBackend *be = (PGBackend *) cb_data;
- if (0 == acc->idata) return;
- acc->inst.kvp_data = pgendKVPFetch (be, acc->idata, acc->inst.kvp_data);
+ guint32 a_idata = qof_instance_get_idata(acc);
+ if (0 == a_idata) return;
+ acc->inst.kvp_data = pgendKVPFetch (be, a_idata, acc->inst.kvp_data);
}
static void
@@ -301,7 +305,7 @@
if (commodity)
xaccAccountSetCommodity(acc, commodity);
qof_instance_set_version(acc, atoi(DB_GET_VAL("version",j)));
- acc->idata = atoi(DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(acc, atoi(DB_GET_VAL("iguid",j)));
/* try to find the parent account */
PINFO ("parent GUID=%s", DB_GET_VAL("parentGUID",j));
@@ -475,6 +479,7 @@
char *pbuff;
Account *acc = NULL;
int engine_data_is_newer = 0;
+ guint32 a_idata;
ENTER ("be=%p", be);
if (!be || !acct_guid) return 0;
@@ -523,9 +528,10 @@
/* restore any kvp data associated with the transaction and splits */
if (acc)
{
- if (acc->idata)
+ a_idata = qof_instance_get_idata(acc);
+ if (a_idata)
{
- acc->inst.kvp_data = pgendKVPFetch (be, acc->idata, acc->inst.kvp_data);
+ acc->inst.kvp_data = pgendKVPFetch (be, a_idata, acc->inst.kvp_data);
}
qof_instance_set_version_check(acc, be->version_check);
@@ -597,7 +603,7 @@
if (qof_instance_get_destroying(acct))
{
const GUID *guid = xaccAccountGetGUID(acct);
- pgendKVPDelete (be, acct->idata);
+ pgendKVPDelete (be, qof_instance_get_idata(acct));
p = be->buff; *p = 0;
p = stpcpy (p, "DELETE FROM gncAccount WHERE accountGuid='");
Modified: gnucash/trunk/src/backend/postgres/book.c
===================================================================
--- gnucash/trunk/src/backend/postgres/book.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/book.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -69,7 +69,7 @@
pgendStoreBookNoLock (PGBackend *be, QofBook *book,
gboolean do_check_version)
{
- gint32 idata;
+ guint32 idata;
if (!be || !book) return;
ENTER ("book=%p", book);
@@ -80,14 +80,14 @@
}
qof_book_set_version(book, (qof_book_get_version(book) +1)); /* be sure to update the version !! */
- if ((0 == qof_book_get_idata(book)) &&
+ if ((0 == qof_instance_get_idata(book)) &&
(FALSE == kvp_frame_is_empty (qof_book_get_slots(book))))
{
- qof_book_set_idata(book, pgendNewGUIDidx(be));
+ qof_instance_set_idata(book, pgendNewGUIDidx(be));
}
pgendPutOneBookOnly (be, book);
- idata = qof_book_get_idata(book);
+ idata = qof_instance_get_idata(book);
if ( idata > 0)
{
pgendKVPDelete (be, idata);
@@ -146,7 +146,7 @@
qof_book_mark_closed(book);
}
qof_book_set_version(book, atoi(DB_GET_VAL("version",j)));
- qof_book_set_idata(book, atoi(DB_GET_VAL("iguid",j)));
+ qof_instance_set_idata(book, atoi(DB_GET_VAL("iguid",j)));
return book;
}
@@ -174,11 +174,11 @@
SEND_QUERY (be, bufp, );
pgendGetResults (be, get_one_book_cb, book);
- if (0 != qof_book_get_idata(book))
+ if (0 != qof_instance_get_idata(book))
{
KvpFrame *pg_frame;
- pg_frame = pgendKVPFetch (be, qof_book_get_idata(book),
+ pg_frame = pgendKVPFetch (be, qof_instance_get_idata(book),
qof_instance_get_slots((QofInstance*)book));
kvp_frame_for_each_slot(pg_frame, pg_kvp_helper, book);
}
@@ -224,7 +224,7 @@
}
// book->book_open = (DB_GET_VAL("book_open",j))[0];
qof_book_set_version(book, atoi(DB_GET_VAL("version",j)));
- qof_book_set_idata(book, atoi(DB_GET_VAL("iguid",j)));
+ qof_instance_set_idata(book, atoi(DB_GET_VAL("iguid",j)));
return blist;
}
@@ -247,17 +247,18 @@
for (node=blist; node; node=node->next)
{
QofBook *book = node->data;
- if (0 != qof_book_get_idata(book))
+ if (0 != qof_instance_get_idata(book))
{
KvpFrame *pg_frame;
- pg_frame = pgendKVPFetch (be, qof_book_get_idata(book),
+ pg_frame = pgendKVPFetch (be, qof_instance_get_idata(book),
qof_instance_get_slots((QofInstance*)book));
kvp_frame_for_each_slot(pg_frame, pg_kvp_helper, book);
}
-/* if (0 != book->idata)
+/* if (0 != qof_instance_get_idata(book))
{
- book->inst.kvp_data = pgendKVPFetch (be, book->idata, book->inst.kvp_data);
+ book->inst.kvp_data = pgendKVPFetch(be, qof_instance_get_idata(book),
+ book->inst.kvp_data);
}*/
}
Modified: gnucash/trunk/src/backend/postgres/table.m4
===================================================================
--- gnucash/trunk/src/backend/postgres/table.m4 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/table.m4 2007-05-03 03:56:31 UTC (rev 16042)
@@ -12,7 +12,7 @@
type, , char *, xaccAccountTypeEnumAsString(xaccAccountGetType(ptr)),
commodity, , char *, gnc_commodity_get_unique_name(xaccAccountGetCommodity(ptr)),
version, , int32, qof_instance_get_version(ptr),
- iguid, , int32, ptr->idata,
+ iguid, , int32, qof_instance_get_idata(ptr),
bookGUID, , GUID *, qof_instance_get_guid((QofInstance*)gnc_account_get_book(ptr)),
parentGUID, , GUID *, xaccAccountGetGUID(gnc_account_get_parent(ptr)),
accountGUID, KEY, GUID *, xaccAccountGetGUID(ptr),
@@ -21,7 +21,7 @@
define(`book', `gncBook, Book, QofBook, b,
book_open, , char, qof_book_get_open_marker(ptr),
version, , int32, qof_book_get_version(ptr),
- iguid, , int32, qof_book_get_idata(ptr),
+ iguid, , int32, qof_instance_get_idata(ptr),
bookGUID, KEY, GUID *, qof_book_get_guid(ptr),
')
@@ -34,7 +34,7 @@
date_reconciled, , Timespec, xaccSplitRetDateReconciledTS(ptr),
amount, , int64, gnc_numeric_num(xaccSplitGetAmount(ptr)),
value, , int64, gnc_numeric_num(xaccSplitGetValue(ptr)),
- iguid, , int32, ptr->idata,
+ iguid, , int32, qof_instance_get_idata(ptr),
splitGuid, KEY, GUID *, xaccSplitGetGUID(ptr),
')
@@ -53,7 +53,7 @@
date_entered, , Timespec, xaccTransRetDateEnteredTS(ptr),
date_posted, , Timespec, xaccTransRetDatePostedTS(ptr),
version, , int32, qof_instance_get_version(ptr),
- iguid, , int32, ptr->idata,
+ iguid, , int32, qof_instance_get_idata(ptr),
transGUID, KEY, GUID *, xaccTransGetGUID(ptr),
')
Modified: gnucash/trunk/src/backend/postgres/txn.c
===================================================================
--- gnucash/trunk/src/backend/postgres/txn.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/txn.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -133,6 +133,7 @@
gboolean do_check_version)
{
GList *start, *deletelist=NULL, *node;
+ guint32 s_idata, t_idata;
char * p;
if (!be || !trans) return;
@@ -220,23 +221,27 @@
for (node=start; node; node=node->next)
{
Split * s = node->data;
- if ((0 == s->idata) &&
+ s_idata = qof_instance_get_idata(s);
+ if ((0 == s_idata) &&
(FALSE == kvp_frame_is_empty (xaccSplitGetSlots(s))))
{
- s->idata = pgendNewGUIDidx(be);
+ s_idata = pgendNewGUIDidx(be);
+ qof_instance_set_idata(s, s_idata);
}
pgendPutOneSplitOnly (be, s);
- if (s->idata)
+ if (s_idata)
{
- pgendKVPDelete (be, s->idata);
- pgendKVPStore (be, s->idata, s->inst.kvp_data);
+ pgendKVPDelete (be, s_idata);
+ pgendKVPStore (be, s_idata, s->inst.kvp_data);
}
}
- if ((0 == trans->idata) &&
+ t_idata = qof_instance_get_idata(trans);
+ if ((0 == t_idata) &&
(FALSE == kvp_frame_is_empty (xaccTransGetSlots(trans))))
{
- trans->idata = pgendNewGUIDidx(be);
+ t_idata = pgendNewGUIDidx(be);
+ qof_instance_set_idata(trans, t_idata);
}
/* Make sure the commodity is in the table.
@@ -246,10 +251,10 @@
pgendPutOneTransactionOnly (be, trans);
- if (trans->idata)
+ if (t_idata)
{
- pgendKVPDelete (be, trans->idata);
- pgendKVPStore (be, trans->idata, trans->inst.kvp_data);
+ pgendKVPDelete (be, t_idata);
+ pgendKVPStore (be, t_idata, trans->inst.kvp_data);
}
}
else
@@ -282,9 +287,11 @@
for (node=start; node; node=node->next)
{
Split * s = node->data;
- if (0 != s->idata) pgendKVPDelete (be, s->idata);
+ s_idata = qof_instance_get_idata(s);
+ if (0 != s_idata) pgendKVPDelete (be, s_idata);
}
- if (0 != trans->idata) pgendKVPDelete (be, trans->idata);
+ t_idata = qof_instance_get_idata(trans);
+ if (0 != t_idata) pgendKVPDelete (be, t_idata);
}
LEAVE(" ");
@@ -479,7 +486,7 @@
xaccSplitSetDateReconciledTS (s, &ts);
xaccSplitSetReconcile (s, (DB_GET_VAL("reconciled", j))[0]);
- s->idata = atoi(DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(s, atoi(DB_GET_VAL("iguid",j)));
/* --------------------------------------------- */
/* next, find the account that this split goes into */
@@ -632,6 +639,7 @@
int engine_data_is_newer = 0;
int j;
GList *node, *engine_splits;
+ guint32 s_idata, t_idata;
ENTER ("be=%p", be);
if (!be || !trans_guid) return 0;
@@ -755,7 +763,7 @@
xaccTransSetDateEnteredTS (trans, &ts);
qof_instance_set_version (trans, atoi(DB_GET_VAL("version",j)));
xaccTransSetCurrency (trans, currency);
- trans->idata = atoi(DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(trans, atoi(DB_GET_VAL("iguid",j)));
}
}
@@ -782,7 +790,8 @@
/* ------------------------------------------------- */
/* restore any kvp data associated with the transaction and splits */
- if (0 != trans->idata)
+ t_idata = qof_instance_get_idata(trans);
+ if (0 != t_idata)
{
if (!kvp_frame_is_empty (trans->inst.kvp_data))
{
@@ -790,14 +799,15 @@
trans->inst.kvp_data = kvp_frame_new ();
}
- trans->inst.kvp_data = pgendKVPFetch (be, trans->idata, trans->inst.kvp_data);
+ trans->inst.kvp_data = pgendKVPFetch (be, t_idata, trans->inst.kvp_data);
}
engine_splits = xaccTransGetSplitList(trans);
for (node = engine_splits; node; node=node->next)
{
Split *s = node->data;
- if (0 != s->idata)
+ s_idata = qof_instance_get_idata(s);
+ if (0 != s_idata)
{
if (!kvp_frame_is_empty (s->inst.kvp_data))
{
@@ -805,7 +815,7 @@
s->inst.kvp_data = kvp_frame_new ();
}
- s->inst.kvp_data = pgendKVPFetch (be, s->idata, s->inst.kvp_data);
+ s->inst.kvp_data = pgendKVPFetch (be, s_idata, s->inst.kvp_data);
}
}
Modified: gnucash/trunk/src/backend/postgres/txnmass.c
===================================================================
--- gnucash/trunk/src/backend/postgres/txnmass.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/backend/postgres/txnmass.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -94,7 +94,7 @@
ts = gnc_iso8601_to_timespec_gmt (DB_GET_VAL("date_entered",j));
xaccTransSetDateEnteredTS (trans, &ts);
qof_instance_set_version (trans, atoi(DB_GET_VAL("version",j)));
- trans->idata = atoi (DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(trans, atoi(DB_GET_VAL("iguid",j)));
currency = gnc_string_to_commodity (DB_GET_VAL("currency",j), book);
@@ -147,7 +147,7 @@
xaccSplitSetDateReconciledTS (s, &ts);
xaccSplitSetReconcile (s, (DB_GET_VAL("reconciled", j))[0]);
- s->idata = atoi (DB_GET_VAL("iguid",j));
+ qof_instance_set_idata(s, atoi(DB_GET_VAL("iguid",j)));
guid = nullguid; /* just in case the read fails ... */
string_to_guid (DB_GET_VAL("transGUID",j), &guid);
@@ -214,6 +214,7 @@
char *p, buff[900];
GList *node, *xaction_list = NULL;
Account *root;
+ guint32 t_idata, s_idata;
qof_event_suspend();
pgendDisable(be);
@@ -258,18 +259,20 @@
* We won't do this en-mass, as there currently seems to be no
* performance advantage to doing so */
- if (trans->idata)
+ t_idata = qof_instance_get_idata(trans);
+ if (t_idata)
{
- trans->inst.kvp_data = pgendKVPFetch (be, trans->idata, trans->inst.kvp_data);
+ trans->inst.kvp_data = pgendKVPFetch (be, t_idata, trans->inst.kvp_data);
}
splits = xaccTransGetSplitList(trans);
for (snode = splits; snode; snode=snode->next)
{
Split *s = snode->data;
- if (s->idata)
+ s_idata = qof_instance_get_idata(s);
+ if (s_idata)
{
- s->inst.kvp_data = pgendKVPFetch (be, s->idata, s->inst.kvp_data);
+ s->inst.kvp_data = pgendKVPFetch (be, s_idata, s->inst.kvp_data);
}
}
Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/Account.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -726,8 +726,6 @@
ENTER ("book=%p\n", book);
qof_instance_init_data (&acc->inst, GNC_ID_ACCOUNT, book);
- acc->idata = 0;
-
LEAVE ("account=%p\n", acc);
}
Modified: gnucash/trunk/src/engine/AccountP.h
===================================================================
--- gnucash/trunk/src/engine/AccountP.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/AccountP.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -53,10 +53,6 @@
struct account_s
{
QofInstance inst;
-
- /* -------------------------------------------------------------- */
- /* Backend private expansion data */
- guint32 idata; /* used by the sql backend for kvp management */
};
/* Set the account's GUID. This should only be done when reading
Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/Split.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -101,8 +101,6 @@
split->cleared_balance = gnc_numeric_zero();
split->reconciled_balance = gnc_numeric_zero();
- split->idata = 0;
-
split->gains = GAINS_STATUS_UNKNOWN;
split->gains_split = NULL;
@@ -134,7 +132,7 @@
if (split->inst.kvp_data)
kvp_frame_delete(split->inst.kvp_data);
split->inst.kvp_data = kvp_frame_new();
- split->idata = 0;
+ qof_instance_set_idata(split, 0);
split->gains = GAINS_STATUS_UNKNOWN;
split->gains_split = NULL;
@@ -217,7 +215,6 @@
split->balance = s->balance;
split->cleared_balance = s->cleared_balance;
split->reconciled_balance = s->reconciled_balance;
- split->idata = 0;
split->gains = GAINS_STATUS_UNKNOWN;
split->gains_split = NULL;
@@ -255,7 +252,7 @@
printf(" CBalance: %s\n", gnc_numeric_to_string(split->cleared_balance));
printf(" RBalance: %s\n",
gnc_numeric_to_string(split->reconciled_balance));
- printf(" idata: %x\n", split->idata);
+ printf(" idata: %x\n", qof_instance_get_idata(split));
}
#endif
Modified: gnucash/trunk/src/engine/SplitP.h
===================================================================
--- gnucash/trunk/src/engine/SplitP.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/SplitP.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -125,10 +125,6 @@
gnc_numeric balance;
gnc_numeric cleared_balance;
gnc_numeric reconciled_balance;
-
- /* -------------------------------------------------------------- */
- /* Backend private expansion data */
- guint32 idata; /* used by the sql backend for kvp management */
};
struct _SplitClass
Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/Transaction.c 2007-05-03 03:56:31 UTC (rev 16042)
@@ -274,7 +274,6 @@
trans->marker = 0;
trans->orig = NULL;
- trans->idata = 0;
qof_instance_init_data (&trans->inst, GNC_ID_TRANS, book);
LEAVE (" ");
}
@@ -314,7 +313,7 @@
printf(" version_chk: %x\n", qof_instance_get_version_check(trans));
printf(" editlevel: %x\n", qof_instance_get_editlevel(trans));
printf(" orig: %p\n", trans->orig);
- printf(" idata: %x\n", trans->idata);
+ printf(" idata: %x\n", qof_instance_get_idata(trans));
printf(" splits: ");
for (node = trans->splits; node; node = node->next)
{
@@ -424,7 +423,6 @@
qof_instance_copy_version_check(trans, t);
trans->orig = NULL;
- trans->idata = 0;
qof_instance_init_data (&trans->inst, GNC_ID_TRANS, qof_instance_get_book(t));
kvp_frame_delete (trans->inst.kvp_data);
Modified: gnucash/trunk/src/engine/TransactionP.h
===================================================================
--- gnucash/trunk/src/engine/TransactionP.h 2007-05-03 02:56:56 UTC (rev 16041)
+++ gnucash/trunk/src/engine/TransactionP.h 2007-05-03 03:56:31 UTC (rev 16042)
@@ -110,10 +110,6 @@
* any changes made if/when the edit is abandoned.
*/
Transaction *orig;
-
- /* -------------------------------------------------------------- */
- /* Backend private expansion data */
- guint32 idata; /* used by the sql backend for kvp management */
};
struct _TransactionClass
More information about the gnucash-changes
mailing list