From cc88f1e8c358e63733a02ceea5e1323bcd9c3455 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 14 Sep 2006 16:45:46 +0000 Subject: [PATCH] - added an implicit close() on the cursor in ResultProxy when the result closes - added scalar() method to ComposedSQLEngine --- CHANGES | 3 +++ lib/sqlalchemy/engine/base.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES b/CHANGES index 3f664c4989..bf64c367d9 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,9 @@ is used to get() an instance thats already loaded - fixed bug where Connection wouldnt lose its Transaction after commit/rollback - added extract() function to sql dialect +- added an implicit close() on the cursor in ResultProxy +when the result closes +- added scalar() method to ComposedSQLEngine 0.2.8 - cleanup on connection methods + documentation. custom DBAPI diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index fad84eef86..cf321bca2b 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() -- 2.47.2