Updated Branches: refs/heads/trunk c3ab05f39 -> dfca30cb3
cqlsh: Remove redundant import null-handling logic Now that we support 'null' in INSERT (CASSANDRA-3783), do_import_delete step is now unnecessary. Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6c4b7746 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6c4b7746 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6c4b7746 Branch: refs/heads/trunk Commit: 6c4b774686b3424ce84f7de51c56c86d95c85d4c Parents: 6a4af0c Author: Aleksey Yeschenko <[email protected]> Authored: Thu Apr 4 21:56:22 2013 +0300 Committer: Aleksey Yeschenko <[email protected]> Committed: Thu Apr 4 21:56:22 2013 +0300 ---------------------------------------------------------------------- bin/cqlsh | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c4b7746/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index 2456009..5292d5e 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -1633,12 +1633,9 @@ class Shell(cmd.Cmd): rowmap[name] = self.cql_protect_value(value) else: rowmap[name] = value - if not self.do_import_insert(layout, rowmap): - return False - nulls = set(columns) - set(rowmap.keys()) - if nulls: - return self.do_import_delete(layout, rowmap, nulls) - return True + else: + rowmap[name] = 'null' + return self.do_import_insert(layout, rowmap) def do_import_insert(self, layout, rowmap): # would be nice to be able to use a prepared query here, but in order @@ -1656,19 +1653,6 @@ class Shell(cmd.Cmd): print 'Import using CQL: %s' % query return self.perform_statement_untraced(query) - def do_import_delete(self, layout, rowmap, nulls): - pk_components = layout.primary_key_components - where = [(self.cql_protect_name(pk), rowmap[pk]) for pk in pk_components] - query = 'DELETE %s FROM %s.%s WHERE %s' % ( - ', '.join(self.cql_protect_names(nulls)), - self.cql_protect_name(layout.keyspace_name), - self.cql_protect_name(layout.columnfamily_name), - ' AND '.join([ '%s = %s' % kv for kv in where]) - ) - if self.debug: - print 'Import using CQL: %s' % query - return self.perform_statement_untraced(query) - def perform_csv_export(self, ks, cf, columns, fname, opts): dialect_options = self.csv_dialect_defaults.copy() if 'quote' in opts:
