Author: eevans
Date: Tue Apr 19 17:35:25 2011
New Revision: 1095143
URL: http://svn.apache.org/viewvc?rev=1095143&view=rev
Log:
use dbapi interface for decoded values
Patch by eevans; reviewed by jbellis for CASSANDRA-2505
Modified:
cassandra/branches/cassandra-0.8/drivers/py/cqlsh
Modified: cassandra/branches/cassandra-0.8/drivers/py/cqlsh
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/py/cqlsh?rev=1095143&r1=1095142&r2=1095143&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/py/cqlsh (original)
+++ cassandra/branches/cassandra-0.8/drivers/py/cqlsh Tue Apr 19 17:35:25 2011
@@ -90,14 +90,15 @@ class Shell(cmd.Cmd):
cursor.execute(statement)
if isinstance(cursor.result, ResultSet):
- for row in cursor.result.rows:
- self.printout(row.key, BLUE, False)
- for column in row.columns:
+ for x in range(cursor.rowcount):
+ row = cursor.fetchone()
+ self.printout(row[0], BLUE, False)
+ for (i, value) in enumerate(row[1:]):
+ name = cursor.description[i+1][0]
self.printout(" | ", newline=False)
- # XXX: repr() is better than trying to print binary
- self.printout(repr(column.name), MAGENTA, False)
+ self.printout(repr(name), MAGENTA, False)
self.printout(",", newline=False)
- self.printout(repr(column.value), YELLOW, False)
+ self.printout(repr(value), YELLOW, False)
self.printout("")
else:
if cursor.result: print cursor.result[0]