You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by st...@apache.org on 2016/11/11 03:03:21 UTC
[02/10] cassandra git commit: cqlsh COPY: unprotected pk values
before converting them if not using prepared statements
cqlsh COPY: unprotected pk values before converting them if not using prepared statements
patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-12863
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2e21cac3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2e21cac3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2e21cac3
Branch: refs/heads/cassandra-3.0
Commit: 2e21cac342750d1bf1426bd72e14fd3dfd094fb1
Parents: ca85bec
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Mon Oct 31 09:20:19 2016 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Fri Nov 11 10:55:25 2016 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e21cac3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b550885..98c1839 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.9
+ * cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863)
* Fix Util.spinAssertEquals (CASSANDRA-12283)
* Fix potential NPE for compactionstats (CASSANDRA-12462)
* Prepare legacy authenticate statement if credentials table initialised after node startup (CASSANDRA-12813)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e21cac3/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index aee2920..0c11636 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1778,15 +1778,18 @@ class ImportConversion(object):
where_clause)
return parent.session.prepare(select_query)
+ @staticmethod
+ def unprotect(v):
+ if v is not None:
+ return CqlRuleSet.dequote_value(v)
+
def _get_converter(self, cql_type):
"""
Return a function that converts a string into a value the can be passed
into BoundStatement.bind() for the given cql type. See cassandra.cqltypes
for more details.
"""
- def unprotect(v):
- if v is not None:
- return CqlRuleSet.dequote_value(v)
+ unprotect = self.unprotect
def convert(t, v):
v = unprotect(v)
@@ -2028,7 +2031,7 @@ class ImportConversion(object):
return self.cqltypes[n].serialize(v, self.proto_version)
def serialize_value_not_prepared(n, v):
- return self.cqltypes[n].serialize(self.converters[n](v), self.proto_version)
+ return self.cqltypes[n].serialize(self.converters[n](self.unprotect(v)), self.proto_version)
partition_key_indexes = self.partition_key_indexes
serialize = serialize_value_prepared if self.use_prepared_statements else serialize_value_not_prepared