Author: jbellis
Date: Fri May 13 15:34:51 2011
New Revision: 1102793

URL: http://svn.apache.org/viewvc?rev=1102793&view=rev
Log:
fix cqlsh

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=1102793&r1=1102792&r2=1102793&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/py/cqlsh (original)
+++ cassandra/branches/cassandra-0.8/drivers/py/cqlsh Fri May 13 15:34:51 2011
@@ -30,7 +30,7 @@ try:
 except ImportError:
     sys.path.append(os.path.abspath(os.path.dirname(__file__)))
     import cql
-from cql.results import ResultSet
+from cql.cursor import _COUNT_DESCRIPTION
 
 HISTORY = os.path.join(os.path.expanduser('~'), '.cqlsh')
 CQLTYPES = ("bytes", "ascii", "utf8", "timeuuid", "uuid", "long", "int")
@@ -131,7 +131,9 @@ class Shell(cmd.Cmd):
 
         self.cursor.execute(statement)
 
-        if isinstance(self.cursor.result, ResultSet):
+        if self.cursor.description is _COUNT_DESCRIPTION:
+            if self.cursor.result: print self.cursor.result[0]
+        else:
             for x in range(self.cursor.rowcount):
                 row = self.cursor.fetchone()
                 self.printout(repr(row[0]), BLUE, False)
@@ -142,8 +144,6 @@ class Shell(cmd.Cmd):
                     self.printout(",", newline=False)
                     self.printout(repr(value), YELLOW, False)
                 self.printout("")
-        else:
-            if self.cursor.result: print self.cursor.result[0]
 
     def emptyline(self):
         pass


Reply via email to