summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/mysqldb.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-18 11:48:24 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-18 11:48:24 -0400
commit074cab9e7d01533302e84a489d740accad25476a (patch)
tree8dc562c8f06633531bb59b1ca75f84a4ef0d7970 /lib/sqlalchemy/dialects/mysql/mysqldb.py
parentb6b4f60e746c1aa895c35e31e9843da5d4270f18 (diff)
downloadsqlalchemy-074cab9e7d01533302e84a489d740accad25476a.tar.gz
- moved most Decimal bind/result handling into types.py, out of sqlite, mysql dialects.
- added an explicit test for [ticket:1216] - some questions remain about MSSQL - would like to simplify/remove bind handling for numerics
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/mysqldb.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/mysqldb.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py
index 038e58a4c..9d34939a1 100644
--- a/lib/sqlalchemy/dialects/mysql/mysqldb.py
+++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py
@@ -20,11 +20,10 @@ strings, also pass ``use_unicode=0`` in the connection arguments::
create_engine('mysql:///mydb?charset=utf8&use_unicode=0')
"""
-import decimal
import re
-from sqlalchemy.dialects.mysql.base import (DECIMAL, MySQLDialect, MySQLExecutionContext,
- MySQLCompiler, MySQLIdentifierPreparer, NUMERIC, _NumericType)
+from sqlalchemy.dialects.mysql.base import (MySQLDialect, MySQLExecutionContext,
+ MySQLCompiler, MySQLIdentifierPreparer)
from sqlalchemy.engine import base as engine_base, default
from sqlalchemy.sql import operators as sql_operators
from sqlalchemy import exc, log, schema, sql, types as sqltypes, util
@@ -48,20 +47,6 @@ class MySQLCompiler_mysqldb(MySQLCompiler):
return text.replace('%', '%%')
-class _DecimalType(_NumericType):
- def result_processor(self, dialect, coltype):
- if self.asdecimal:
- return None
- return processors.to_float
-
-
-class _MySQLdbNumeric(_DecimalType, NUMERIC):
- pass
-
-
-class _MySQLdbDecimal(_DecimalType, DECIMAL):
- pass
-
class MySQLIdentifierPreparer_mysqldb(MySQLIdentifierPreparer):
def _escape_identifier(self, value):
@@ -74,6 +59,8 @@ class MySQLDialect_mysqldb(MySQLDialect):
supports_sane_rowcount = True
supports_sane_multi_rowcount = True
+ supports_native_decimal = True
+
default_paramstyle = 'format'
execution_ctx_cls = MySQLExecutionContext_mysqldb
statement_compiler = MySQLCompiler_mysqldb
@@ -82,8 +69,6 @@ class MySQLDialect_mysqldb(MySQLDialect):
colspecs = util.update_copy(
MySQLDialect.colspecs,
{
- sqltypes.Numeric: _MySQLdbNumeric,
- DECIMAL: _MySQLdbDecimal
}
)