[libgda] Added function to detect if alias is already enquoted



commit e2025f2a6611507f4c6123a71abb17e479871f68
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Oct 17 20:47:49 2011 +0200

    Added function to detect if alias is already enquoted

 libgda/gda-statement.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libgda/gda-statement.c b/libgda/gda-statement.c
index a77f2ca..6a40828 100644
--- a/libgda/gda-statement.c
+++ b/libgda/gda-statement.c
@@ -1954,6 +1954,16 @@ default_render_case (GdaSqlCase *case_s, GdaSqlRenderingContext *context, GError
 	return NULL;
 }
 
+static gboolean
+alias_is_quoted (const gchar *alias)
+{
+	g_assert (alias);
+	if ((*alias == '\'') || (*alias == '"'))
+		return TRUE;
+	else
+		return FALSE;
+}
+
 static gchar *
 default_render_select_field (GdaSqlSelectField *field, GdaSqlRenderingContext *context, GError **error)
 {
@@ -1973,7 +1983,7 @@ default_render_select_field (GdaSqlSelectField *field, GdaSqlRenderingContext *c
 	g_free (str);
 
 	if (field->as) {
-		if ((*field->as != '\'') && (*field->as != '"')) {
+		if (! alias_is_quoted (field->as)) {
 			GdaConnectionOptions cncoptions = 0;
 			gchar *tmp;
 			if (context->cnc)
@@ -2027,7 +2037,7 @@ default_render_select_target (GdaSqlSelectTarget *target, GdaSqlRenderingContext
 	}
 
 	if (target->as) {
-		if ((*target->as != '\'') && (*target->as != '"')) {
+		if (! alias_is_quoted (target->as)) {
 			GdaConnectionOptions cncoptions = 0;
 			gchar *tmp;
 			if (context->cnc)



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