[libgda] Parser: correction in the way the delimiter parser parses parameters



commit 1d1d70edbd49d8b77ab910d2c54c85b03444301b
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Aug 5 16:31:30 2011 +0200

    Parser: correction in the way the delimiter parser parses parameters

 libgda/sql-parser/gda-sql-parser.c |    4 +++-
 tests/parser/testdata.xml          |    5 +++++
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgda/sql-parser/gda-sql-parser.c b/libgda/sql-parser/gda-sql-parser.c
index ef17c62..3b3adee 100644
--- a/libgda/sql-parser/gda-sql-parser.c
+++ b/libgda/sql-parser/gda-sql-parser.c
@@ -1494,7 +1494,7 @@ getToken (GdaSqlParser *parser)
 				else {
 					for (i=1; z[i] && (! isspace (z[i])) &&
 						     (z[i] != parser->priv->context->delimiter) && (z[i] != '*') &&
-						     (z[i] != '\'') && (z[i] != '"'); i++){}
+						     (z[i] != '\'') && (z[i] != '"') && (z[i] != '#'); i++){}
 					parser->priv->context->token_type = L_RAWSTRING;
 					consumed_chars = i;
 				}
@@ -1527,6 +1527,8 @@ getToken (GdaSqlParser *parser)
 		g_print ("%d (%s)\n", parser->priv->context->token_type, str);
 		g_free (str);
 	}
+	else if (parser->priv->context->token_type == L_END_OF_FILE)
+		g_print ("%d (END OF FILE)\n", parser->priv->context->token_type);
 	else
 		g_print ("%d\n", parser->priv->context->token_type);
 #endif
diff --git a/tests/parser/testdata.xml b/tests/parser/testdata.xml
index 4c6806b..528369c 100644
--- a/tests/parser/testdata.xml
+++ b/tests/parser/testdata.xml
@@ -32,6 +32,11 @@
     <expected>{"statements":[{"statement":{"sql":"##pname::gint::null","stmt_type":"UNKNOWN","contents":[{"value":null,"param_spec":{"name":"pname","descr":null,"type":"int","is_param":true,"nullok":true}}]}}]}</expected>
   </test>
 
+  <test id="4.1">
+    <sql>value=##myparam</sql>
+    <expected>{"statements":[{"statement":{"sql":"value=##myparam","stmt_type":"UNKNOWN","contents":[{"value":"value="},{"value":null,"param_spec":{"name":"myparam","descr":null,"type":null,"is_param":true,"nullok":false}}]}}]}</expected>
+  </test>
+
   <!-- Extendend param notation, unspec value -->
   <test id="5">
     <sql>##/* name:pname */</sql>



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