gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Aug 19 18:33:08 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/8d415fdf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/518fc2ff (commit)
	from  https://github.com/Gnucash/gnucash/commit/31b69628 (commit)



commit 8d415fdfdeee63d9bd3b0858230d10df95d605dd
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Aug 19 15:32:33 2016 -0700

    Bug 770113 - compiling issue with libdbi.
    
    On OpenSuSe. They've taken to using libdbi's git repo instead of the last
    tarball (0.9.0 in March 2013) and there's a significant change in the
    data format.

diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c
index 331f5b8..a716ad2 100644
--- a/src/backend/dbi/gnc-backend-dbi.c
+++ b/src/backend/dbi/gnc-backend-dbi.c
@@ -70,9 +70,11 @@
 
 #if LIBDBI_VERSION >= 900
 #define HAVE_LIBDBI_R 1
+#define HAVE_LIBDBI_TO_LONGLONG 1
 static dbi_inst dbi_instance = NULL;
 #else
 #define HAVE_LIBDBI_R 0
+#define HAVE_LIBDBI_TO_LONGLONG 0
 #endif
 
 /* For direct access to dbi data structs, sadly needed for datetime */
@@ -2208,15 +2210,21 @@ row_get_value_at_col_name( GncSqlRow* row, const gchar* col_name )
         }
 	else
 	{
+#if HAVE_LIBDBI_TO_LONGLONG
+            /* A less evil hack than the one required by libdbi-0.8, but still
+             * necessary to work around the same bug.
+             */
+            time64 time = dbi_result_get_as_longlong(dbi_row->result,
+                                                     col_name);
+#else
 	    /* A seriously evil hack to work around libdbi bug #15
-	     * https://sourceforge.net/p/libdbi/bugs/15/. When libdbi
-	     * v0.9 is widely available this can be replaced with
-	     * dbi_result_get_as_longlong.
+	     * https://sourceforge.net/p/libdbi/bugs/15/.
 	     */
 	    dbi_result_t *result = (dbi_result_t*)(dbi_row->result);
 	    guint64 row = dbi_result_get_currow (result);
 	    guint idx = dbi_result_get_field_idx (result, col_name) - 1;
 	    time64 time = result->rows[row]->field_values[idx].d_datetime;
+#endif
 	    (void)g_value_init( value, G_TYPE_INT64 );
 	    g_value_set_int64 (value, time);
 	}

commit 518fc2ffae0b867712154d8ade593113a6c8e208
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Aug 19 15:29:10 2016 -0700

    Fix compilation error in sqlite3_error_fn.
    
    Oddly, this was fixed in master as part of building the file as C++. Even
    more oddly no C compiler caught the type error for 6 years and it's not clear
    to me what happened to make clang notice it now.

diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c
index f075202..331f5b8 100644
--- a/src/backend/dbi/gnc-backend-dbi.c
+++ b/src/backend/dbi/gnc-backend-dbi.c
@@ -240,10 +240,12 @@ static void
 sqlite3_error_fn( dbi_conn conn, /*@ unused @*/ void* user_data )
 {
     const gchar* msg;
+    GncDbiBackend *be = (GncDbiBackend*)user_data;
+    GncDbiSqlConnection *dbi_conn = (GncDbiSqlConnection*)(be->sql_be.conn);
 
     (void)dbi_conn_error( conn, &msg );
     PERR( "DBI error: %s\n", msg );
-    gnc_dbi_set_error( conn, ERR_BACKEND_MISC, 0, FALSE );
+    gnc_dbi_set_error( dbi_conn, ERR_BACKEND_MISC, 0, FALSE );
 }
 
 static void



Summary of changes:
 src/backend/dbi/gnc-backend-dbi.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list