diff options
| author | Chris Withers <chris@simplistix.co.uk> | 2010-04-13 16:48:24 +0100 |
|---|---|---|
| committer | Chris Withers <chris@simplistix.co.uk> | 2010-04-13 16:48:24 +0100 |
| commit | 7de6de60fcf4fcdc58344bafa1d718868f12c516 (patch) | |
| tree | 7564092fb9db7d3e93c2dbd3132b881781e69f88 /lib/sqlalchemy | |
| parent | 51148074083b88d61761f29e86bd7655acdb9620 (diff) | |
| parent | 5745f7a7c2eade1ff70ad7831854e4212eefe1bd (diff) | |
| download | sqlalchemy-7de6de60fcf4fcdc58344bafa1d718868f12c516.tar.gz | |
merge tip
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/dialects/firebird/kinterbasdb.py | 24 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 18 |
2 files changed, 26 insertions, 16 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 diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 78c65771b..7a1821a70 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -548,9 +548,12 @@ class SQLCompiler(engine.Compiled): ) elif getattr(existing, '_is_crud', False): raise exc.CompileError( - "Bind parameter name '%s' is reserved " - "for the VALUES or SET clause of this insert/update statement." - % bindparam.key + "bindparam() name '%s' is reserved " + "for automatic usage in the VALUES or SET clause of this " + "insert/update statement. Please use a " + "name other than column name when using bindparam() " + "with insert() or update() (for example, 'b_%s')." + % (bindparam.key, bindparam.key) ) self.binds[bindparam.key] = self.binds[name] = bindparam @@ -906,9 +909,12 @@ class SQLCompiler(engine.Compiled): bindparam._is_crud = True if col.key in self.binds: raise exc.CompileError( - "Bind parameter name '%s' is reserved " - "for the VALUES or SET clause of this insert/update statement." - % col.key + "bindparam() name '%s' is reserved " + "for automatic usage in the VALUES or SET clause of this " + "insert/update statement. Please use a " + "name other than column name when using bindparam() " + "with insert() or update() (for example, 'b_%s')." + % (col.key, col.key) ) self.binds[col.key] = bindparam |
