summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-01-27 23:59:12 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-01-27 23:59:12 +0000
commit58447f6af60fd99ef8a82144458c7620a69d2afb (patch)
tree76f27879621d21858400bf6bf1a8095cc594a3b5 /lib/sqlalchemy/sql.py
parentd917119235e7b43413e9b191492e0f5f48425cb0 (diff)
downloadsqlalchemy-58447f6af60fd99ef8a82144458c7620a69d2afb.tar.gz
2nd scalar fix
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index 4ec7cbb7b..dcf153866 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -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)