cqlsh: Fix tab completion for case-sensitive identifiers

Patch by Mahdi Mohammadi; reviewed by Tyler Hobbs for CASSANDRA-11664


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b8f5c1fc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b8f5c1fc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b8f5c1fc

Branch: refs/heads/cassandra-3.7
Commit: b8f5c1fcecf30e096b4a36904fdc12550910c854
Parents: 43e9d29
Author: Mahdi Mohammadi <mah...@gmail.com>
Authored: Tue May 31 11:58:06 2016 -0500
Committer: Tyler Hobbs <tylerlho...@gmail.com>
Committed: Wed Jun 1 12:38:49 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                    | 1 +
 pylib/cqlshlib/cql3handling.py | 6 ++++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b8f5c1fc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ffd5b31..c97293d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.7
+ * cqlsh: fix tab completion for case-sensitive identifiers (CASSANDRA-11664)
  * Avoid showing estimated key as -1 in tablestats (CASSANDRA-11587)
  * Fix possible race condition in CommitLog.recover (CASSANDRA-11743)
  * Enable client encryption in sstableloader with cli options (CASSANDRA-11708)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b8f5c1fc/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 81e13c9..897ee16 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -90,6 +90,12 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet):
             return str(value)
         return "'%s'" % value.replace("'", "''")
 
+    @classmethod
+    def escape_name(cls, name):
+        if name is None:
+            return 'NULL'
+        return "'%s'" % name.replace("'", "''")
+
     @staticmethod
     def dequote_name(name):
         name = name.strip()

Reply via email to