From: Mike Bayer Date: Fri, 27 Jan 2006 23:59:12 +0000 (+0000) Subject: 2nd scalar fix X-Git-Tag: rel_0_1_0~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=58447f6af60fd99ef8a82144458c7620a69d2afb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 2nd scalar fix --- diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 4ec7cbb7bf..dcf153866e 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)