From bee9ae363fe341c86072ddd2fb95af52b35bcace Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 31 Jul 2014 00:34:51 +0200 Subject: [PATCH] Fix ag_db_select() Using parameter @err for error collection was a bad idea. Creating local_err instead. --- src/ag-db.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ag-db.c b/src/ag-db.c index 8473d84..1772016 100644 --- a/src/ag-db.c +++ b/src/ag-db.c @@ -196,8 +196,9 @@ ag_db_select(AgDb *db, GError **err, const gchar *sql, ...) GdaSet *params; GdaStatement *sth; GdaDataModel *ret; - gchar *error = NULL; - AgDbPrivate *priv = ag_db_get_instance_private(db); + gchar *error = NULL; + GError *local_err = NULL; + AgDbPrivate *priv = ag_db_get_instance_private(db); parser = g_object_get_data(G_OBJECT(priv->conn), "parser"); @@ -205,21 +206,21 @@ ag_db_select(AgDb *db, GError **err, const gchar *sql, ...) parser, sql, &remain, - err + &local_err )) == NULL) { g_error( "SQL error: %s", - (*err && (*err)->message) - ? (*err)->message + (local_err && local_err->message) + ? local_err->message : "no reason" ); } - if (!gda_statement_get_parameters(sth, ¶ms, err)) { + if (!gda_statement_get_parameters(sth, ¶ms, &local_err)) { g_error( "SQL error: %s", - (*err && (*err)->message) - ? (*err)->message + (local_err && local_err->message) + ? local_err->message : "no reason" ); }