r18109 - gnucash/trunk/src/backend/sql - Fix SQL statement which calculates account balances by adding ORDER BY clause. SQLite3

Phil Longstaff plongstaff at code.gnucash.org
Sat Jun 6 19:31:42 EDT 2009


Author: plongstaff
Date: 2009-06-06 19:31:42 -0400 (Sat, 06 Jun 2009)
New Revision: 18109
Trac: http://svn.gnucash.org/trac/changeset/18109

Modified:
   gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
Log:
Fix SQL statement which calculates account balances by adding ORDER BY clause.  SQLite3
returned the values sorted even without it, but postgresql and mysql need the ORDER BY
clause to work correctly.


Modified: gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-transaction-sql.c	2009-06-06 17:08:43 UTC (rev 18108)
+++ gnucash/trunk/src/backend/sql/gnc-transaction-sql.c	2009-06-06 23:31:42 UTC (rev 18109)
@@ -853,7 +853,7 @@
 
 	g_return_val_if_fail( be != NULL, NULL );
 
-	buf = g_strdup_printf( "SELECT account_guid, reconcile_state, sum(quantity_num) as quantity_num, quantity_denom FROM %s GROUP BY account_guid, reconcile_state, quantity_denom",
+	buf = g_strdup_printf( "SELECT account_guid, reconcile_state, sum(quantity_num) as quantity_num, quantity_denom FROM %s GROUP BY account_guid, reconcile_state, quantity_denom ORDER BY account_guid, reconcile_state",
 						SPLIT_TABLE );
 	stmt = gnc_sql_create_statement_from_sql( be, buf );
 	g_assert( stmt != NULL );



More information about the gnucash-changes mailing list