summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-20 21:50:59 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-20 21:50:59 +0000
commit109d5359617bf8c9a8acc6498935a22f9f6949ef (patch)
treebe3bbeb9543852da0e1c9d27ca67876b2a25cf80 /lib/sqlalchemy/databases
parent531faf0e187d756bda92a937a77accd86b813339 (diff)
downloadsqlalchemy-109d5359617bf8c9a8acc6498935a22f9f6949ef.tar.gz
- method call removal
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r--lib/sqlalchemy/databases/access.py12
-rw-r--r--lib/sqlalchemy/databases/firebird.py14
-rw-r--r--lib/sqlalchemy/databases/informix.py6
-rw-r--r--lib/sqlalchemy/databases/mssql.py33
-rw-r--r--lib/sqlalchemy/databases/mysql.py18
-rw-r--r--lib/sqlalchemy/databases/oracle.py12
-rw-r--r--lib/sqlalchemy/databases/postgres.py9
-rw-r--r--lib/sqlalchemy/databases/sqlite.py8
8 files changed, 41 insertions, 71 deletions
diff --git a/lib/sqlalchemy/databases/access.py b/lib/sqlalchemy/databases/access.py
index f901ebf53..4994e3309 100644
--- a/lib/sqlalchemy/databases/access.py
+++ b/lib/sqlalchemy/databases/access.py
@@ -6,7 +6,7 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import random
-from sqlalchemy import sql, schema, ansisql, types, exceptions, pool
+from sqlalchemy import sql, schema, types, exceptions, pool
from sqlalchemy.sql import compiler
import sqlalchemy.engine.default as default
@@ -159,7 +159,7 @@ class AccessExecutionContext(default.DefaultExecutionContext):
const, daoEngine = None, None
-class AccessDialect(ansisql.ANSIDialect):
+class AccessDialect(compiler.DefaultDialect):
colspecs = {
types.Unicode : AcUnicode,
types.Integer : AcInteger,
@@ -176,6 +176,9 @@ class AccessDialect(ansisql.ANSIDialect):
types.TIMESTAMP: AcTimeStamp,
}
+ supports_sane_rowcount = False
+
+
def type_descriptor(self, typeobj):
newobj = types.adapt_type(typeobj, self.colspecs)
return newobj
@@ -211,9 +214,6 @@ class AccessDialect(ansisql.ANSIDialect):
def create_execution_context(self, *args, **kwargs):
return AccessExecutionContext(self, *args, **kwargs)
- def supports_sane_rowcount(self):
- return False
-
def last_inserted_ids(self):
return self.context.last_inserted_ids
@@ -416,7 +416,7 @@ class AccessSchemaDropper(compiler.SchemaDropper):
self.append("\nDROP INDEX [%s].[%s]" % (index.table.name, index.name))
self.execute()
-class AccessDefaultRunner(ansisql.ANSIDefaultRunner):
+class AccessDefaultRunner(compiler.DefaultRunner):
pass
class AccessIdentifierPreparer(compiler.IdentifierPreparer):
diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py
index 9cccb53e8..2a9bbb5bd 100644
--- a/lib/sqlalchemy/databases/firebird.py
+++ b/lib/sqlalchemy/databases/firebird.py
@@ -101,6 +101,9 @@ class FBExecutionContext(default.DefaultExecutionContext):
class FBDialect(default.DefaultDialect):
+ supports_sane_rowcount = False
+ max_identifier_length = 31
+
def __init__(self, type_conv=200, concurrency_level=1, **kwargs):
default.DefaultDialect.__init__(self, **kwargs)
@@ -133,12 +136,6 @@ class FBDialect(default.DefaultDialect):
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- def supports_sane_rowcount(self):
- return False
-
- def max_identifier_length(self):
- return 31
-
def table_names(self, connection, schema):
s = "SELECT R.RDB$RELATION_NAME FROM RDB$RELATIONS R"
return [row[0] for row in connection.execute(s)]
@@ -408,12 +405,11 @@ RESERVED_WORDS = util.Set(
class FBIdentifierPreparer(compiler.IdentifierPreparer):
+ reserved_words = RESERVED_WORDS
+
def __init__(self, dialect):
super(FBIdentifierPreparer,self).__init__(dialect, omit_schema=True)
- def _reserved_words(self):
- return RESERVED_WORDS
-
dialect = FBDialect
dialect.statement_compiler = FBCompiler
diff --git a/lib/sqlalchemy/databases/informix.py b/lib/sqlalchemy/databases/informix.py
index 45dfb0370..67d31387d 100644
--- a/lib/sqlalchemy/databases/informix.py
+++ b/lib/sqlalchemy/databases/informix.py
@@ -205,6 +205,8 @@ class InfoExecutionContext(default.DefaultExecutionContext):
return informix_cursor( self.connection.connection )
class InfoDialect(default.DefaultDialect):
+ # for informix 7.31
+ max_identifier_length = 18
def __init__(self, use_ansi=True,**kwargs):
self.use_ansi = use_ansi
@@ -216,10 +218,6 @@ class InfoDialect(default.DefaultDialect):
return informixdb
dbapi = classmethod(dbapi)
- def max_identifier_length( self ):
- # for informix 7.31
- return 18
-
def is_disconnect(self, e):
if isinstance(e, self.dbapi.OperationalError):
return 'closed the connection' in str(e) or 'connection not open' in str(e)
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 1985d2112..03b276d4a 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -472,10 +472,6 @@ class MSSQLDialect(default.DefaultDialect):
def last_inserted_ids(self):
return self.context.last_inserted_ids
- # this is only implemented in the dbapi-specific subclasses
- def supports_sane_rowcount(self):
- raise NotImplementedError()
-
def get_default_schema_name(self, connection):
return self.schema_name
@@ -665,6 +661,8 @@ class MSSQLDialect(default.DefaultDialect):
table.append_constraint(schema.ForeignKeyConstraint(scols, ['%s.%s' % (t,c) for (s,t,c) in rcols], fknm))
class MSSQLDialect_pymssql(MSSQLDialect):
+ supports_sane_rowcount = False
+
def import_dbapi(cls):
import pymssql as module
# pymmsql doesn't have a Binary method. we use string
@@ -683,12 +681,6 @@ class MSSQLDialect_pymssql(MSSQLDialect):
super(MSSQLDialect_pymssql, self).__init__(**params)
self.use_scope_identity = True
- def supports_sane_rowcount(self):
- return False
-
- def max_identifier_length(self):
- return 30
-
def do_rollback(self, connection):
# pymssql throws an error on repeated rollbacks. Ignore it.
# TODO: this is normal behavior for most DBs. are we sure we want to ignore it ?
@@ -746,6 +738,9 @@ class MSSQLDialect_pymssql(MSSQLDialect):
## r.fetch_array()
class MSSQLDialect_pyodbc(MSSQLDialect):
+ supports_sane_rowcount = False
+ # PyODBC unicode is broken on UCS-4 builds
+ supports_unicode_statements = sys.maxunicode == 65535
def __init__(self, **params):
super(MSSQLDialect_pyodbc, self).__init__(**params)
@@ -771,14 +766,6 @@ class MSSQLDialect_pyodbc(MSSQLDialect):
ischema_names['smalldatetime'] = MSDate_pyodbc
ischema_names['datetime'] = MSDateTime_pyodbc
- def supports_sane_rowcount(self):
- return False
-
- def supports_unicode_statements(self):
- """indicate whether the DBAPI can receive SQL statements as Python unicode strings"""
- # PyODBC unicode is broken on UCS-4 builds
- return sys.maxunicode == 65535
-
def make_connect_string(self, keys):
if 'dsn' in keys:
connectors = ['dsn=%s' % keys['dsn']]
@@ -818,6 +805,9 @@ class MSSQLDialect_pyodbc(MSSQLDialect):
context._last_inserted_ids = [int(row[0])]
class MSSQLDialect_adodbapi(MSSQLDialect):
+ supports_sane_rowcount = True
+ supports_unicode_statements = True
+
def import_dbapi(cls):
import adodbapi as module
return module
@@ -831,13 +821,6 @@ class MSSQLDialect_adodbapi(MSSQLDialect):
ischema_names['nvarchar'] = AdoMSNVarchar
ischema_names['datetime'] = MSDateTime_adodbapi
- def supports_sane_rowcount(self):
- return True
-
- def supports_unicode_statements(self):
- """indicate whether the DBAPI can receive SQL statements as Python unicode strings"""
- return True
-
def make_connect_string(self, keys):
connectors = ["Provider=SQLOLEDB"]
if 'port' in keys:
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 41c6ec70f..6dc0d6057 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -1332,6 +1332,12 @@ class MySQLExecutionContext(default.DefaultExecutionContext):
class MySQLDialect(default.DefaultDialect):
"""Details of the MySQL dialect. Not used directly in application code."""
+ supports_alter = True
+ supports_unicode_statements = False
+ # identifiers are 64, however aliases can be 255...
+ max_identifier_length = 255
+ supports_sane_rowcount = True
+
def __init__(self, use_ansiquotes=False, **kwargs):
self.use_ansiquotes = use_ansiquotes
kwargs.setdefault('default_paramstyle', 'format')
@@ -1390,13 +1396,6 @@ class MySQLDialect(default.DefaultDialect):
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- # identifiers are 64, however aliases can be 255...
- def max_identifier_length(self):
- return 255;
-
- def supports_sane_rowcount(self):
- return True
-
def compiler(self, statement, bindparams, **kwargs):
return MySQLCompiler(statement, bindparams, dialect=self, **kwargs)
@@ -2369,13 +2368,12 @@ MySQLSchemaReflector.logger = logging.class_logger(MySQLSchemaReflector)
class _MySQLIdentifierPreparer(compiler.IdentifierPreparer):
"""MySQL-specific schema identifier configuration."""
+
+ reserved_words = RESERVED_WORDS
def __init__(self, dialect, **kw):
super(_MySQLIdentifierPreparer, self).__init__(dialect, **kw)
- def _reserved_words(self):
- return RESERVED_WORDS
-
def _fold_identifier_case(self, value):
# TODO: determine MySQL's case folding rules
#
diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py
index 580850818..9b3ffbf23 100644
--- a/lib/sqlalchemy/databases/oracle.py
+++ b/lib/sqlalchemy/databases/oracle.py
@@ -232,6 +232,11 @@ class OracleExecutionContext(default.DefaultExecutionContext):
return base.ResultProxy(self)
class OracleDialect(default.DefaultDialect):
+ supports_alter = True
+ supports_unicode_statements = False
+ max_identifier_length = 30
+ supports_sane_rowcount = True
+
def __init__(self, use_ansi=True, auto_setinputsizes=True, auto_convert_lobs=True, threaded=True, allow_twophase=True, **kwargs):
default.DefaultDialect.__init__(self, default_paramstyle='named', **kwargs)
self.use_ansi = use_ansi
@@ -291,13 +296,6 @@ class OracleDialect(default.DefaultDialect):
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- def supports_unicode_statements(self):
- """indicate whether the DB-API can receive SQL statements as Python unicode strings"""
- return False
-
- def max_identifier_length(self):
- return 30
-
def oid_column_name(self, column):
if not isinstance(column.table, (sql.TableClause, sql.Select)):
return None
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 29d84ad4d..2a4d230cd 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -223,6 +223,11 @@ class PGExecutionContext(default.DefaultExecutionContext):
super(PGExecutionContext, self).post_exec()
class PGDialect(default.DefaultDialect):
+ supports_alter = True
+ supports_unicode_statements = False
+ max_identifier_length = 63
+ supports_sane_rowcount = True
+
def __init__(self, use_oids=False, server_side_cursors=False, **kwargs):
default.DefaultDialect.__init__(self, default_paramstyle='pyformat', **kwargs)
self.use_oids = use_oids
@@ -241,13 +246,9 @@ class PGDialect(default.DefaultDialect):
opts.update(url.query)
return ([], opts)
-
def create_execution_context(self, *args, **kwargs):
return PGExecutionContext(self, *args, **kwargs)
- def max_identifier_length(self):
- return 63
-
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index c2aced4d0..8618bfc3e 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -174,6 +174,8 @@ class SQLiteExecutionContext(default.DefaultExecutionContext):
return SELECT_REGEXP.match(self.statement)
class SQLiteDialect(default.DefaultDialect):
+ supports_alter = False
+ supports_unicode_statements = True
def __init__(self, **kwargs):
default.DefaultDialect.__init__(self, default_paramstyle='qmark', **kwargs)
@@ -199,9 +201,6 @@ class SQLiteDialect(default.DefaultDialect):
def server_version_info(self, connection):
return self.dbapi.sqlite_version_info
- def supports_alter(self):
- return False
-
def create_connect_args(self, url):
filename = url.database or ':memory:'
@@ -220,9 +219,6 @@ class SQLiteDialect(default.DefaultDialect):
def create_execution_context(self, **kwargs):
return SQLiteExecutionContext(self, **kwargs)
- def supports_unicode_statements(self):
- return True
-
def last_inserted_ids(self):
return self.context.last_inserted_ids