summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/firebird
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-12 20:20:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-12 20:20:50 -0400
commit731ad9b0b956fb3b9d318576661ede51b3d4f596 (patch)
treecf1b661b6635e4cc9deeb54c3cf3d99d10675059 /lib/sqlalchemy/dialects/firebird
parent47ef5ed5f72b9d65a48780ee561ae84e8b05becb (diff)
downloadsqlalchemy-731ad9b0b956fb3b9d318576661ede51b3d4f596.tar.gz
further testing reveals that cursor.rowcount is only called with update/delete and DDL,
and also that FB's cursor.rowcount is a little expensive, but not dramatically. added a test to ensure cursor.rowcount is only called on update/delete. the current default for firebird enable_rowcount is now True, leaving all the options to turn it off etc..
Diffstat (limited to 'lib/sqlalchemy/dialects/firebird')
-rw-r--r--lib/sqlalchemy/dialects/firebird/kinterbasdb.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
index 890ba83fe..84963ba8b 100644
--- a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
+++ b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
@@ -19,15 +19,19 @@ Kinterbasedb backend specific keyword arguments are:
* concurrency_level - set the backend policy with regards to threading issues: by default
SQLAlchemy uses policy 1 (see details__).
-* enable_rowcount - False by default, this enables the usage of "cursor.rowcount" with the
- Kinterbasdb dialect. When disabled, SQLAlchemy's ResultProxy will
- return -1 for result.rowcount. The rationale here is that Kinterbasdb
- requires a second round trip to the database when .rowcount is called -
- since SQLA's resultproxy automatically closes the cursor after a
- non-result-returning statement, rowcount must be called, if at all,
- before the result object is returned. The behavior can also be
- controlled on a per-execution basis using the `enable_rowcount`
- option with :meth:`execution_options()`::
+* enable_rowcount - True by default, setting this to False disables
+ the usage of "cursor.rowcount" with the
+ Kinterbasdb dialect, which SQLAlchemy ordinarily calls upon automatically
+ after any UPDATE or DELETE statement. When disabled, SQLAlchemy's
+ ResultProxy will return -1 for result.rowcount. The rationale here is
+ that Kinterbasdb requires a second round trip to the database when
+ .rowcount is called - since SQLA's resultproxy automatically closes
+ the cursor after a non-result-returning statement, rowcount must be
+ called, if at all, before the result object is returned. Additionally,
+ cursor.rowcount may not return correct results with older versions
+ of Firebird, and setting this flag to False will also cause the SQLAlchemy ORM
+ to ignore its usage. The behavior can also be controlled on a per-execution
+ basis using the `enable_rowcount` option with :meth:`execution_options()`::
conn = engine.connect().execution_options(enable_rowcount=True)
r = conn.execute(stmt)
@@ -77,7 +81,7 @@ class FBDialect_kinterbasdb(FBDialect):
)
- def __init__(self, type_conv=200, concurrency_level=1, enable_rowcount=False, **kwargs):
+ def __init__(self, type_conv=200, concurrency_level=1, enable_rowcount=True, **kwargs):
super(FBDialect_kinterbasdb, self).__init__(**kwargs)
self.enable_rowcount = enable_rowcount
self.type_conv = type_conv