summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-12-13 12:53:56 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-12-13 12:53:56 -0500
commit68fb34ba57aa5820dd4e175fe942dabf4ee62999 (patch)
tree291775de6d163e30e3ae671f87f22261c8edb0f0 /lib/sqlalchemy/dialects
parent09961886961668dcf452a1139eb8584bf48e2539 (diff)
downloadsqlalchemy-68fb34ba57aa5820dd4e175fe942dabf4ee62999.tar.gz
- system to cache the bind/result processors in a dialect-wide registry.
its an idea with pointy edges.
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/mysql/base.py26
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py3
2 files changed, 26 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index 42072699e..deeebf0f9 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -237,6 +237,12 @@ class _NumericType(object):
self.unsigned = kw.pop('unsigned', False)
self.zerofill = kw.pop('zerofill', False)
super(_NumericType, self).__init__(**kw)
+
+ def adapt(self, typeimpl, **kw):
+ return super(_NumericType, self).adapt(
+ typeimpl,
+ unsigned=self.unsigned,
+ zerofill=self.zerofill)
class _FloatType(_NumericType, sqltypes.Float):
def __init__(self, precision=None, scale=None, asdecimal=True, **kw):
@@ -257,6 +263,11 @@ class _IntegerType(_NumericType, sqltypes.Integer):
self.display_width = display_width
super(_IntegerType, self).__init__(**kw)
+ def adapt(self, typeimpl, **kw):
+ return super(_IntegerType, self).adapt(
+ typeimpl,
+ display_width=self.display_width)
+
class _StringType(sqltypes.String):
"""Base for MySQL string types."""
@@ -276,6 +287,17 @@ class _StringType(sqltypes.String):
self.binary = binary
self.national = national
super(_StringType, self).__init__(**kw)
+
+ def adapt(self, typeimpl, **kw):
+ return super(_StringType, self).adapt(
+ typeimpl,
+ charset=self.charset,
+ collation=self.collation,
+ ascii=self.ascii,
+ binary=self.binary,
+ national=self.national,
+ **kw
+ )
def __repr__(self):
attributes = inspect.getargspec(self.__init__)[0][1:]
@@ -990,8 +1012,8 @@ class SET(_StringType):
strip_values.append(a)
self.values = strip_values
- length = max([len(v) for v in strip_values] + [0])
- super(SET, self).__init__(length=length, **kw)
+ kw.setdefault('length', max([len(v) for v in strip_values] + [0]))
+ super(SET, self).__init__(**kw)
def result_processor(self, dialect, coltype):
def process(value):
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index a74ea0c3c..47a43bdf1 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -72,7 +72,8 @@ class _DateTimeMixin(object):
_reg = None
_storage_format = None
- def __init__(self, storage_format=None, regexp=None, **kwargs):
+ def __init__(self, storage_format=None, regexp=None, **kw):
+ super(_DateTimeMixin, self).__init__(**kw)
if regexp is not None:
self._reg = re.compile(regexp)
if storage_format is not None: