From cc88f1e8c358e63733a02ceea5e1323bcd9c3455 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 14 Sep 2006 16:45:46 +0000 Subject: - added an implicit close() on the cursor in ResultProxy when the result closes - added scalar() method to ComposedSQLEngine --- lib/sqlalchemy/engine/base.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/sqlalchemy/engine') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index fad84eef8..cf321bca2 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -466,6 +466,10 @@ class ComposedSQLEngine(sql.Engine, Connectable): def execute(self, statement, *multiparams, **params): connection = self.contextual_connect(close_with_result=True) return connection.execute(statement, *multiparams, **params) + + def scalar(self, statement, *multiparams, **params): + connection = self.contextual_connect(close_with_result=True) + return connection.scalar(statement, *multiparams, **params) def execute_compiled(self, compiled, *multiparams, **params): connection = self.contextual_connect(close_with_result=True) @@ -564,6 +568,7 @@ class ResultProxy: def close(self): if not self.closed: self.closed = True + self.cursor.close() if self.connection.should_close_with_result and self.dialect.supports_autoclose_results: self.connection.close() -- cgit v1.2.1