[libgda] SQL rendering correction
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] SQL rendering correction
- Date: Wed, 26 Aug 2009 19:34:12 +0000 (UTC)
commit d0b5e9b724cbc6622b41f8756136d2c0d4fb7c42
Author: Vivien Malerba <malerba gnome-db org>
Date: Wed Aug 26 21:32:18 2009 +0200
SQL rendering correction
so that statements containing "EXISTS (SELECT ...)" will be
rendered correctly.
libgda/gda-statement.c | 12 +++++++++---
libgda/sqlite/gda-sqlite-provider.c | 10 ++++++++--
providers/oracle/gda-oracle-provider.c | 10 ++++++++--
tools/browser/Makefile.am | 25 ++++++++-----------------
4 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/libgda/gda-statement.c b/libgda/gda-statement.c
index 29ea8b1..9a98f4c 100644
--- a/libgda/gda-statement.c
+++ b/libgda/gda-statement.c
@@ -1375,8 +1375,14 @@ default_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context, gboolean
else
g_assert_not_reached ();
if (!str1) goto err;
- str = g_strdup_printf ("(%s)", str1);
- g_free (str1);
+
+ 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);
+ g_free (str1);
+ }
+ else
+ str = str1;
}
else if (expr->case_s) {
str = context->render_case (GDA_SQL_ANY_PART (expr->case_s), context, error);
@@ -1477,7 +1483,7 @@ default_render_function (GdaSqlFunction *func, GdaSqlRenderingContext *context,
if (!gda_sql_any_part_check_structure (GDA_SQL_ANY_PART (func), error)) return NULL;
string = g_string_new (func->function_name);
- g_string_append_c (string, '(');
+ g_string_append (string, " (");
for (list = func->args_list; list; list = list->next) {
if (list != func->args_list)
g_string_append (string, ", ");
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 1f30796..0ea46e8 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -1568,8 +1568,14 @@ sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
else
str1 = context->render_compound (GDA_SQL_ANY_PART (expr->select), context, error);
if (!str1) goto err;
- str = g_strdup_printf ("(%s)", str1);
- g_free (str1);
+
+ 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);
+ g_free (str1);
+ }
+ else
+ str = str1;
}
else if (expr->case_s) {
str = context->render_case (GDA_SQL_ANY_PART (expr->case_s), context, error);
diff --git a/providers/oracle/gda-oracle-provider.c b/providers/oracle/gda-oracle-provider.c
index cd672c1..69022a6 100644
--- a/providers/oracle/gda-oracle-provider.c
+++ b/providers/oracle/gda-oracle-provider.c
@@ -1501,8 +1501,14 @@ oracle_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
gchar *str1;
str1 = context->render_select (GDA_SQL_ANY_PART (expr->select), context, error);
if (!str1) goto err;
- str = g_strdup_printf ("(%s)", str1);
- g_free (str1);
+
+ 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);
+ g_free (str1);
+ }
+ else
+ str = str1;
}
else if (expr->case_s) {
str = context->render_case (GDA_SQL_ANY_PART (expr->case_s), context, error);
diff --git a/tools/browser/Makefile.am b/tools/browser/Makefile.am
index 060a3ae..0bf5503 100644
--- a/tools/browser/Makefile.am
+++ b/tools/browser/Makefile.am
@@ -1,10 +1,10 @@
bin_PROGRAMS=gda-browser-4.0
-noinst_PROGRAMS = favorites-test
+noinst_LTLIBRARIES = libbrowser.la
SUBDIRS = data common schema-browser dummy-perspective
if HAVE_GOOCANVAS
SUBDIRS+=canvas
-noinst_PROGRAMS+=canvas-example
+noinst_PROGRAMS=canvas-example
endif
AM_CPPFLAGS = \
@@ -23,7 +23,7 @@ marshal.h: marshal.list $(GLIB_GENMARSHAL)
marshal.c: marshal.list $(GLIB_GENMARSHAL) marshal.h
$(GLIB_GENMARSHAL) $< --body --prefix=_marshal > $@
-gda_browser_4_0_SOURCES=\
+libbrowser_la_SOURCES=\
cc-gray-bar.c \
cc-gray-bar.h \
marshal.c \
@@ -37,8 +37,6 @@ gda_browser_4_0_SOURCES=\
login-dialog.h \
support.c \
support.h \
- browser-core.c \
- browser-core.h \
browser-page.c \
browser-page.h \
browser-perspective.c \
@@ -55,12 +53,15 @@ gda_browser_4_0_SOURCES=\
browser-window.h \
browser-connections-list.c \
browser-connections-list.h \
- main.c \
mgr-favorites.h \
mgr-favorites.c \
browser-stock-icons.c \
browser-stock-icons.h
+gda_browser_4_0_SOURCES=\
+ browser-core.c \
+ browser-core.h \
+ main.c
$(OBJECTS): marshal.c marshal.h
@@ -85,6 +86,7 @@ gda_browser_4_0_LDFLAGS = $(EXTRALDFLAGS)
gda_browser_4_0_LDADD=\
$(top_builddir)/tools/browser/schema-browser/libperspective.la \
$(top_builddir)/tools/browser/dummy-perspective/libperspective.la \
+ $(top_builddir)/tools/browser/libbrowser.la \
$(CANVAS_LDADD) \
$(top_builddir)/tools/browser/common/libcommon.la \
$(top_builddir)/libgda/libgda-4.0.la \
@@ -92,17 +94,6 @@ gda_browser_4_0_LDADD=\
$(LIBGDA_LIBS) $(GTK_LIBS)
-favorites_test_SOURCES=\
- browser-favorites.c \
- browser-favorites.h \
- favorites-test.c
-
-favorites_test_LDADD=\
- $(top_builddir)/tools/browser/schema-browser/libperspective.la \
- $(top_builddir)/tools/browser/dummy-perspective/libperspective.la \
- $(top_builddir)/libgda/libgda-4.0.la \
- $(LIBGDA_LIBS)
-
@INTLTOOL_DESKTOP_RULE@
desktopdir=$(datadir)/applications
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]