summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/mxodbc.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-07-03 18:55:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-07-03 18:55:29 -0400
commit516d675c329bce776efb4728d5237a0586adebf1 (patch)
tree36e79775c6f53fe128142a1c07bc8aa05f77abfe /lib/sqlalchemy/dialects/mssql/mxodbc.py
parent55ae7d784212c3b03ba74d27e1e088486054c993 (diff)
downloadsqlalchemy-516d675c329bce776efb4728d5237a0586adebf1.tar.gz
- idle 78-char adjustments
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/mxodbc.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/mxodbc.py44
1 files changed, 26 insertions, 18 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/mxodbc.py b/lib/sqlalchemy/dialects/mssql/mxodbc.py
index efe763659..64e4ab9db 100644
--- a/lib/sqlalchemy/dialects/mssql/mxodbc.py
+++ b/lib/sqlalchemy/dialects/mssql/mxodbc.py
@@ -18,23 +18,30 @@ Connection is via DSN::
Execution Modes
~~~~~~~~~~~~~~~
-mxODBC features two styles of statement execution, using the ``cursor.execute()``
-and ``cursor.executedirect()`` methods (the second being an extension to the
-DBAPI specification). The former makes use of the native
-parameter binding services of the ODBC driver, while the latter uses string escaping.
-The primary advantage to native parameter binding is that the same statement, when
-executed many times, is only prepared once. Whereas the primary advantage to the
-latter is that the rules for bind parameter placement are relaxed. MS-SQL has very
-strict rules for native binds, including that they cannot be placed within the argument
-lists of function calls, anywhere outside the FROM, or even within subqueries within the
-FROM clause - making the usage of bind parameters within SELECT statements impossible for
-all but the most simplistic statements. For this reason, the mxODBC dialect uses the
-"native" mode by default only for INSERT, UPDATE, and DELETE statements, and uses the
-escaped string mode for all other statements. This behavior can be controlled completely
-via :meth:`~sqlalchemy.sql.expression.Executable.execution_options`
-using the ``native_odbc_execute`` flag with a value of ``True`` or ``False``, where a value of
-``True`` will unconditionally use native bind parameters and a value of ``False`` will
-uncondtionally use string-escaped parameters.
+mxODBC features two styles of statement execution, using the
+``cursor.execute()`` and ``cursor.executedirect()`` methods (the second being
+an extension to the DBAPI specification). The former makes use of a particular
+API call specific to the SQL Server Native Client ODBC driver known
+SQLDescribeParam, while the latter does not.
+
+mxODBC apparently only makes repeated use of a single prepared statement
+when SQLDescribeParam is used. The advantage to prepared statement reuse is
+one of performance. The disadvantage is that SQLDescribeParam has a limited
+set of scenarios in which bind parameters are understood, including that they
+cannot be placed within the argument lists of function calls, anywhere outside
+the FROM, or even within subqueries within the FROM clause - making the usage
+of bind parameters within SELECT statements impossible for all but the most
+simplistic statements.
+
+For this reason, the mxODBC dialect uses the "native" mode by default only for
+INSERT, UPDATE, and DELETE statements, and uses the escaped string mode for
+all other statements.
+
+This behavior can be controlled via
+:meth:`~sqlalchemy.sql.expression.Executable.execution_options` using the
+``native_odbc_execute`` flag with a value of ``True`` or ``False``, where a
+value of ``True`` will unconditionally use native bind parameters and a value
+of ``False`` will uncondtionally use string-escaped parameters.
"""
@@ -46,7 +53,8 @@ from sqlalchemy import util
from sqlalchemy.connectors.mxodbc import MxODBCConnector
from sqlalchemy.dialects.mssql.pyodbc import MSExecutionContext_pyodbc
from sqlalchemy.dialects.mssql.base import (MSExecutionContext, MSDialect,
- MSSQLCompiler, MSSQLStrictCompiler,
+ MSSQLCompiler,
+ MSSQLStrictCompiler,
_MSDateTime, _MSDate, TIME)