cqlsh COPY: unprotected pk values before converting them if not using prepared statements

patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-12863
This commit is contained in:
Stefania Alborghetti 2016-10-31 09:20:19 +08:00
parent ca85bec1df
commit 2e21cac342
2 changed files with 8 additions and 4 deletions

View File

@ -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)

View File

@ -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