]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
2nd scalar fix
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Jan 2006 23:59:12 +0000 (23:59 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Jan 2006 23:59:12 +0000 (23:59 +0000)
lib/sqlalchemy/sql.py

index 4ec7cbb7bfaa3c0ca9cd844a722119b7d167df96..dcf153866e5376027bbbfb77f326a9556ce2a5ae 100644 (file)
@@ -399,7 +399,11 @@ class ClauseElement(object):
         """executes this SQL expression via the execute() method, then 
         returns the first column of the first row.  Useful for executing functions,
         sequences, rowcounts, etc."""
-        return self.execute(*multiparams, **params).fetchone()[0]
+        row = self.execute(*multiparams, **params).fetchone()
+        if row is not None:
+            return row[0]
+        else:
+            return None
 
     def __and__(self, other):
         return and_(self, other)