You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/11/24 19:54:23 UTC

git commit: cqlsh: quote single quotes in strings inside collections

Updated Branches:
  refs/heads/cassandra-1.2 da5ff0805 -> aec8f1670


cqlsh: quote single quotes in strings inside collections

patch by Mikhail Stepura; reviewed by Aleksey Yeschenko for
CASSANDRA-6172


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

Branch: refs/heads/cassandra-1.2
Commit: aec8f16705a4fea6c33e84d5a40d370b99c518e4
Parents: da5ff08
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sun Nov 24 21:51:26 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sun Nov 24 21:53:16 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                  | 1 +
 pylib/cqlshlib/formatting.py | 2 ++
 2 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aec8f167/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c012148..57c1896 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,7 @@
  * Optimize FD phi calculation (CASSANDRA-6386)
  * Improve initial FD phi estimate when starting up (CASSANDRA-6385)
  * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750)
+ * cqlsh: quote single quotes in strings inside collections (CASSANDRA-6172)
 
 
 1.2.12

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aec8f167/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index b571033..44392ce 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -180,6 +180,8 @@ def strftime(time_format, seconds):
 @formatter_for('text')
 def format_value_text(val, encoding, colormap, quote=False, **_):
     escapedval = val.replace(u'\\', u'\\\\')
+    if quote:
+        escapedval = escapedval.replace("'", "''")
     escapedval = unicode_controlchars_re.sub(_show_control_chars, escapedval)
     bval = escapedval.encode(encoding, 'backslashreplace')
     if quote: