r17349 - gnucash/branches/gda-dev2/src/backend/sql - During initial save to db, save the lots (they weren't being written).

Phil Longstaff plongstaff at cvs.gnucash.org
Sun Jul 20 09:55:03 EDT 2008


Author: plongstaff
Date: 2008-07-20 09:55:03 -0400 (Sun, 20 Jul 2008)
New Revision: 17349
Trac: http://svn.gnucash.org/trac/changeset/17349

Modified:
   gnucash/branches/gda-dev2/src/backend/sql/gnc-lots-sql.c
Log:
During initial save to db, save the lots (they weren't being written).



Modified: gnucash/branches/gda-dev2/src/backend/sql/gnc-lots-sql.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/sql/gnc-lots-sql.c	2008-07-20 02:19:42 UTC (rev 17348)
+++ gnucash/branches/gda-dev2/src/backend/sql/gnc-lots-sql.c	2008-07-20 13:55:03 UTC (rev 17349)
@@ -173,8 +173,23 @@
     gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_LOT, col_table );
 }
 
-/* ----------------------------------------------------------------- */
 static void
+do_save_lot( QofInstance* inst, gpointer data )
+{
+	commit_lot( (GncSqlBackend*)data, inst );
+}
+
+static void
+write_lots( GncSqlBackend* be )
+{
+	g_return_if_fail( be != NULL );
+
+    qof_collection_foreach( qof_book_get_collection( be->primary_book, GNC_ID_LOT ),
+                            (QofInstanceForeachCB)do_save_lot, be );
+}
+
+/* ================================================================= */
+static void
 load_lot_guid( const GncSqlBackend* be, GncSqlRow* row,
             QofSetterFunc setter, gpointer pObject,
             const GncSqlColumnTableEntry* table_row )
@@ -221,7 +236,9 @@
         GNC_ID_LOT,
         commit_lot,            /* commit */
         load_all_lots,         /* initial_load */
-        create_lots_tables     /* create tables */
+        create_lots_tables,    /* create tables */
+		NULL, NULL, NULL,
+		write_lots             /* save all */
     };
 
     qof_object_register_backend( GNC_ID_LOT, GNC_SQL_BACKEND, &be_data );



More information about the gnucash-changes mailing list