[libgda/gtk3] Correction to the expression rendering in SQL



commit fe4e39af24a6684bbb70bce657a29e04d7c91846
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu Dec 30 15:06:44 2010 +0100

    Correction to the expression rendering in SQL

 libgda/gda-statement.c               |    9 ++++++---
 tests/data-models/check_data_proxy.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/libgda/gda-statement.c b/libgda/gda-statement.c
index 3206dd7..bf67838 100644
--- a/libgda/gda-statement.c
+++ b/libgda/gda-statement.c
@@ -1424,8 +1424,11 @@ default_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context, gboolean
 		if (!str) goto err;
 	}
 	else if (expr->cond) {
-		str = context->render_operation (GDA_SQL_ANY_PART (expr->cond), context, error);
-		if (!str) goto err;
+		gchar *tmp;
+		tmp = context->render_operation (GDA_SQL_ANY_PART (expr->cond), context, error);
+		if (!tmp) goto err;
+		str = g_strconcat ("(", tmp, ")", NULL);
+		g_free (tmp);
 	}
 	else if (expr->select) {
 		gchar *str1;
@@ -1439,7 +1442,7 @@ default_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context, gboolean
 
 		if (! GDA_SQL_ANY_PART (expr)->parent ||
 		    (GDA_SQL_ANY_PART (expr)->parent->type != GDA_SQL_ANY_SQL_FUNCTION)) {
-			str = g_strdup_printf ("(%s)", str1);
+			str = g_strconcat ("(", str1, ")", NULL);
 			g_free (str1);
 		}
 		else
diff --git a/tests/data-models/check_data_proxy.c b/tests/data-models/check_data_proxy.c
index 120136e..857f1d1 100644
--- a/tests/data-models/check_data_proxy.c
+++ b/tests/data-models/check_data_proxy.c
@@ -719,7 +719,7 @@ do_test_common_read (GdaDataModel *proxy)
 
 
 	filter = gda_data_proxy_get_filter_expr (GDA_DATA_PROXY (proxy));
-	if (!filter || strcmp (filter, "countrycode = 'BFA'")) {
+	if (!filter || strcmp (filter, "(countrycode = 'BFA')")) {
 #ifdef CHECK_EXTRA_INFO
 		g_print ("ERROR: Filter should be '%s' and is '%s'\n", "countrycode = 'BFA'", filter);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]