changeset 351:c74c83253026

~ change quotes needed for non-ascii table/column names
author Eric Prud'hommeaux <eric@w3.org>
date Wed, 16 Feb 2011 13:21:52 -0500
parents c69b9aac210c
children f3cf25dbba52
files sql/src/main/scala/SQL.scala sql/src/test/scala/SQLTest.scala
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/sql/src/main/scala/SQL.scala	Wed Feb 16 10:04:13 2011 -0500
+++ b/sql/src/main/scala/SQL.scala	Wed Feb 16 13:21:52 2011 -0500
@@ -347,12 +347,12 @@
 
   def attribute:Parser[RDB.AttrName] = (
       """[a-zA-Z_]\w*""".r ^^ { x => RDB.AttrName(x) }
-    | """'[^']+'""".r ^^ { x => RDB.AttrName(x.substring(1, x.size - 1)) }
+    | """`[^`]+`""".r ^^ { x => RDB.AttrName(x.substring(1, x.size - 1)) }
   )
 
   def attralias:Parser[AttrAlias] = (
       """[a-zA-Z_]\w*""".r ^^ { x => AttrAlias(Name(x)) }
-    | """'[^']+'""".r ^^ { x => AttrAlias(Name(x.substring(1, x.size - 1))) }
+    | """`[^`]+`""".r ^^ { x => AttrAlias(Name(x.substring(1, x.size - 1))) }
   )
 
   def relationORsubselect:Parser[RelationORSubselect] = (
@@ -362,12 +362,12 @@
 
   def relation:Parser[RDB.RelName] = (
       """[a-zA-Z_]\w*""".r ^^ { x => RDB.RelName(x) }
-    | """'[^']+'""".r ^^ { x => RDB.RelName(x.substring(1, x.size - 1)) }
+    | """`[^`]+`""".r ^^ { x => RDB.RelName(x.substring(1, x.size - 1)) }
   )
 
   def relvar:Parser[RelVar] = (
       """[a-zA-Z_]\w*""".r ^^ { x => RelVar(Name(x)) }
-    | """'[^']+'""".r ^^ { x => RelVar(Name(x)) }
+    | """`[^`]+`""".r ^^ { x => RelVar(Name(x)) }
   )
 
   def tablelist:Parser[(TableList, Set[Expression])] =
--- a/sql/src/test/scala/SQLTest.scala	Wed Feb 16 10:04:13 2011 -0500
+++ b/sql/src/test/scala/SQLTest.scala	Wed Feb 16 13:21:52 2011 -0500
@@ -1032,8 +1032,8 @@
   test("parse single-quoted CJK") {
     val p = SqlParser()
     val s = """
-CREATE TABLE '植物' ('名' varchar(50));
-INSERT INTO '植物' ('名') VALUES ('シソ');
+CREATE TABLE `植物` (`名` varchar(50));
+INSERT INTO `植物` (`名`) VALUES ('シソ');
 """
     val addrs = RDB.Relation(
       "植物",
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.