connectors.append("PWD=%s" % opts.get("password", ""))
return [[";".join(connectors)], {}]
- def create_execution_context(self, *args, **kwargs):
- return AccessExecutionContext(self, *args, **kwargs)
-
def last_inserted_ids(self):
return self.context.last_inserted_ids
dialect.schemadropper = AccessSchemaDropper
dialect.preparer = AccessIdentifierPreparer
dialect.defaultrunner = AccessDefaultRunner
+dialect.execution_ctx_cls = AccessExecutionContext
\ No newline at end of file
self.dbapi.init(type_conv=type_conv, concurrency_level=concurrency_level)
return ([], opts)
- def create_execution_context(self, *args, **kwargs):
- return FBExecutionContext(self, *args, **kwargs)
-
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
dialect.schemadropper = FBSchemaDropper
dialect.defaultrunner = FBDefaultRunner
dialect.preparer = FBIdentifierPreparer
+dialect.execution_ctx_cls = FBExecutionContext
\ No newline at end of file
return ([dsn], opt)
- def create_execution_context(self , *args, **kwargs):
- return InfoExecutionContext(self, *args, **kwargs)
-
def table_names(self, connection, schema):
s = "select tabname from systables"
return [row[0] for row in connection.execute(s)]
dialect.schemagenerator = InfoSchemaGenerator
dialect.schemadropper = InfoSchemaDropper
dialect.preparer = InfoIdentifierPreparer
+dialect.execution_ctx_cls = InfoExecutionContext
\ No newline at end of file
else:
return sqltypes.adapt_type(typeobj, colspecs)
- def create_execution_context(self, connection, **kw):
- return MaxDBExecutionContext(self, connection, **kw)
-
def do_execute(self, cursor, statement, parameters, context=None):
res = cursor.execute(statement, parameters)
if isinstance(res, int) and context is not None:
dialect.schemagenerator = MaxDBSchemaGenerator
dialect.schemadropper = MaxDBSchemaDropper
dialect.defaultrunner = MaxDBDefaultRunner
+dialect.execution_ctx_cls = MaxDBExecutionContext
\ No newline at end of file
name = 'mssql'
supports_default_values = True
supports_empty_insert = False
+ execution_ctx_cls = MSSQLExecutionContext
colspecs = {
sqltypes.Unicode : MSNVarchar,
self.has_window_funcs = bool(int(opts.pop('has_window_funcs')))
return self.make_connect_string(opts)
- def create_execution_context(self, *args, **kwargs):
- return MSSQLExecutionContext(self, *args, **kwargs)
-
def type_descriptor(self, typeobj):
newobj = sqltypes.adapt_type(typeobj, self.colspecs)
# Some types need to know about the dialect
# PyODBC unicode is broken on UCS-4 builds
supports_unicode = sys.maxunicode == 65535
supports_unicode_statements = supports_unicode
+ execution_ctx_cls = MSSQLExecutionContext_pyodbc
def __init__(self, **params):
super(MSSQLDialect_pyodbc, self).__init__(**params)
else:
return False
- def create_execution_context(self, *args, **kwargs):
- return MSSQLExecutionContext_pyodbc(self, *args, **kwargs)
def do_execute(self, cursor, statement, parameters, context=None, **kwargs):
super(MSSQLDialect_pyodbc, self).do_execute(cursor, statement, parameters, context=context, **kwargs)
opts['client_flag'] = client_flag
return [[], opts]
- def create_execution_context(self, connection, **kwargs):
- return MySQLExecutionContext(self, connection, **kwargs)
-
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
dialect.statement_compiler = MySQLCompiler
dialect.schemagenerator = MySQLSchemaGenerator
dialect.schemadropper = MySQLSchemaDropper
+dialect.execution_ctx_cls = MySQLExecutionContext
def do_recover_twophase(self, connection):
pass
- def create_execution_context(self, *args, **kwargs):
- return OracleExecutionContext(self, *args, **kwargs)
-
def has_table(self, connection, table_name, schema=None):
if not schema:
schema = self.get_default_schema_name(connection)
dialect.schemadropper = OracleSchemaDropper
dialect.preparer = OracleIdentifierPreparer
dialect.defaultrunner = OracleDefaultRunner
+dialect.execution_ctx_cls = OracleExecutionContext
\ No newline at end of file
default_paramstyle = 'pyformat'
supports_default_values = True
supports_empty_insert = False
-
+
def __init__(self, server_side_cursors=False, **kwargs):
default.DefaultDialect.__init__(self, **kwargs)
self.server_side_cursors = server_side_cursors
opts.update(url.query)
return ([], opts)
- def create_execution_context(self, *args, **kwargs):
- return PGExecutionContext(self, *args, **kwargs)
-
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
dialect.schemadropper = PGSchemaDropper
dialect.preparer = PGIdentifierPreparer
dialect.defaultrunner = PGDefaultRunner
+dialect.execution_ctx_cls = PGExecutionContext
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- def create_execution_context(self, connection, **kwargs):
- return SQLiteExecutionContext(self, connection, **kwargs)
-
def is_disconnect(self, e):
return isinstance(e, self.dbapi.ProgrammingError) and "Cannot operate on a closed database." in str(e)
colspec += " NOT NULL"
return colspec
- # this doesnt seem to be needed, although i suspect older versions of sqlite might still
- # not directly support composite primary keys
- #def visit_primary_key_constraint(self, constraint):
- # if len(constraint) > 1:
- # self.append(", \n")
- # # put all PRIMARY KEYS in a UNIQUE index
- # self.append("\tUNIQUE (%s)" % string.join([c.name for c in constraint],', '))
- # else:
- # super(SQLiteSchemaGenerator, self).visit_primary_key_constraint(constraint)
-
-class SQLiteSchemaDropper(compiler.SchemaDropper):
- pass
-
class SQLiteIdentifierPreparer(compiler.IdentifierPreparer):
reserved_words = set([
'add', 'after', 'all', 'alter', 'analyze', 'and', 'as', 'asc',
dialect.poolclass = pool.SingletonThreadPool
dialect.statement_compiler = SQLiteCompiler
dialect.schemagenerator = SQLiteSchemaGenerator
-dialect.schemadropper = SQLiteSchemaDropper
dialect.preparer = SQLiteIdentifierPreparer
+dialect.execution_ctx_cls = SQLiteExecutionContext
\ No newline at end of file
supports_unicode_statements = False
supports_sane_rowcount = False
supports_sane_multi_rowcount = False
-
+ execution_ctx_cls = SybaseSQLExecutionContext
+
def __new__(cls, dbapi=None, *args, **kwargs):
if cls != SybaseSQLDialect:
return super(SybaseSQLDialect, cls).__new__(cls, *args, **kwargs)
raise ImportError('No DBAPI module detected for SybaseSQL - please install mxodbc')
dbapi = classmethod(dbapi)
- def create_execution_context(self, *args, **kwargs):
- return SybaseSQLExecutionContext(self, *args, **kwargs)
-
def type_descriptor(self, typeobj):
newobj = sqltypes.adapt_type(typeobj, self.colspecs)
return newobj
class SybaseSQLDialect_mxodbc(SybaseSQLDialect):
+ execution_ctx_cls = SybaseSQLExecutionContext_mxodbc
+
def __init__(self, **params):
super(SybaseSQLDialect_mxodbc, self).__init__(**params)
#return True
return False
- def create_execution_context(self, *args, **kwargs):
- return SybaseSQLExecutionContext_mxodbc(self, *args, **kwargs)
-
def do_execute(self, cursor, statement, parameters, context=None, **kwargs):
super(SybaseSQLDialect_mxodbc, self).do_execute(cursor, statement, parameters, context=context, **kwargs)
class SybaseSQLDialect_pyodbc(SybaseSQLDialect):
+ execution_ctx_cls = SybaseSQLExecutionContext_pyodbc
+
def __init__(self, **params):
super(SybaseSQLDialect_pyodbc, self).__init__(**params)
self.dbapi_type_map = {'getdate' : SybaseDate_pyodbc()}
#return True
return False
- def create_execution_context(self, *args, **kwargs):
- return SybaseSQLExecutionContext_pyodbc(self, *args, **kwargs)
-
def do_execute(self, cursor, statement, parameters, context=None, **kwargs):
super(SybaseSQLDialect_pyodbc, self).do_execute(cursor, statement, parameters, context=context, **kwargs)
raise NotImplementedError()
- def create_execution_context(self, connection, compiled=None, compiled_parameters=None, statement=None, parameters=None):
- """Return a new :class:`~sqlalchemy.engine.ExecutionContext` object."""
-
- raise NotImplementedError()
-
def do_begin(self, connection):
"""Provide an implementation of *connection.begin()*, given a DB-API connection."""
a list of Column objects for which a server-side default
or inline SQL expression value was fired off. applies to inserts and updates.
- The Dialect should provide an ExecutionContext via the
- create_execution_context() method. The `pre_exec` and `post_exec`
- methods will be called for compiled statements.
+
"""
def create_cursor(self):
def __create_execution_context(self, **kwargs):
try:
- return self.engine.dialect.create_execution_context(connection=self, **kwargs)
+ dialect = self.engine.dialect
+ return dialect.execution_ctx_cls(dialect, connection=self, **kwargs)
except Exception, e:
self._handle_dbapi_exception(e, kwargs.get('statement', None), kwargs.get('parameters', None), None)
raise
raise exc.ArgumentError("Label length of %d is greater than this dialect's maximum identifier length of %d" % (label_length, self.max_identifier_length))
self.label_length = label_length
- def create_execution_context(self, connection, **kwargs):
- return DefaultExecutionContext(self, connection, **kwargs)
-
def type_descriptor(self, typeobj):
"""Provide a database-specific ``TypeEngine`` object, given
the generic object which comes from the types module.
self.postfetch_cols = self.compiled.postfetch
self.prefetch_cols = self.compiled.prefetch
+
+DefaultDialect.execution_ctx_cls = DefaultExecutionContext
\ No newline at end of file