summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/cymysql.py
diff options
context:
space:
mode:
authorHajime Nakagami <nakagami@gmail.com>2013-03-01 23:27:39 +0900
committerHajime Nakagami <nakagami@gmail.com>2013-03-01 23:27:39 +0900
commit46edfb987241980fcf8b109b98a52ef9d9222a7f (patch)
treea2a99a3c0662f3545a52b729165869e7db0dab18 /lib/sqlalchemy/dialects/mysql/cymysql.py
parent220f2b851a74de510f98fa62559411bcb37ab150 (diff)
downloadsqlalchemy-46edfb987241980fcf8b109b98a52ef9d9222a7f.tar.gz
cython's result_processor()
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/cymysql.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/cymysql.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/cymysql.py b/lib/sqlalchemy/dialects/mysql/cymysql.py
index da06121dc..8f61dcb95 100644
--- a/lib/sqlalchemy/dialects/mysql/cymysql.py
+++ b/lib/sqlalchemy/dialects/mysql/cymysql.py
@@ -15,12 +15,41 @@
"""
from .mysqldb import MySQLDialect_mysqldb
+from .base import (BIT, MySQLDialect)
+from ... import util
+
+class _cymysqlBIT(BIT):
+ def result_processor(self, dialect, coltype):
+ """Convert a MySQL's 64 bit, variable length binary string to a long.
+ """
+
+ def process(value):
+ if value is not None:
+ # Py2K
+ value = 0L
+ for i in map(ord, value):
+ value = value << 8 | i
+ # end Py2K
+ # Py3K
+ #value = 0
+ #for i in value:
+ # value = value << 8 | i
+ return value
+ return process
+
class MySQLDialect_cymysql(MySQLDialect_mysqldb):
driver = 'cymysql'
description_encoding = None
+ colspecs = util.update_copy(
+ MySQLDialect.colspecs,
+ {
+ BIT: _cymysqlBIT,
+ }
+ )
+
@classmethod
def dbapi(cls):
return __import__('cymysql')