You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/07/31 07:10:07 UTC
[8/8] git commit: FIx cqlsh COPY FROM without explicit column names.
Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4470
FIx cqlsh COPY FROM without explicit column names.
Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4470
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/80c3b2dc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/80c3b2dc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/80c3b2dc
Branch: refs/heads/trunk
Commit: 80c3b2dc20ba0cee72188ef03045e3a30a53855e
Parents: 2d71a8e
Author: Brandon Williams <br...@apache.org>
Authored: Sun Jul 29 11:48:44 2012 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Sun Jul 29 11:48:44 2012 -0500
----------------------------------------------------------------------
bin/cqlsh | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/80c3b2dc/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index a60b6f9..6b61364 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -1526,14 +1526,14 @@ class Shell(cmd.Cmd):
try:
if header:
linesource.next()
- prepq = self.prep_import_insert(ks, cf, columns)
+ numcol, prepq = self.prep_import_insert(ks, cf, columns)
rownum = -1
reader = csv.reader(linesource, **dialect_options)
for rownum, row in enumerate(reader):
- if len(row) != len(columns):
+ if len(row) != numcol:
self.printerr("Record #%d (line %d) has the wrong number of fields "
"(%d instead of %d)."
- % (rownum, reader.line_num, len(row), len(columns)))
+ % (rownum, reader.line_num, len(row), numcol))
return rownum
if not self.do_import_insert(prepq, row):
self.printerr("Aborting import at record #%d (line %d). "
@@ -1557,7 +1557,7 @@ class Shell(cmd.Cmd):
# values already, reading them from text just like the various
# Cassandra cql types do. Better just to submit them all as intact
# CQL string literals and let Cassandra do its thing.
- return 'INSERT INTO %s.%s (%s) VALUES (%%s)' % (
+ return len(columns), 'INSERT INTO %s.%s (%s) VALUES (%%s)' % (
self.cql_protect_name(ks),
self.cql_protect_name(cf),
', '.join(map(self.cql_protect_name, columns))