2
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
4
# This module is part of SQLAlchemy and is released under
5
# the MIT License: http://www.opensource.org/licenses/mit-license.php
9
.. dialect:: mysql+cymysql
12
:connectstring: mysql+cymysql://<username>:<password>@<host>/<dbname>[?<options>]
13
:url: https://github.com/nakagami/CyMySQL
17
from .mysqldb import MySQLDialect_mysqldb
18
from .base import (BIT, MySQLDialect)
21
class _cymysqlBIT(BIT):
22
def result_processor(self, dialect, coltype):
23
"""Convert a MySQL's 64 bit, variable length binary string to a long.
30
for i in map(ord, value):
42
class MySQLDialect_cymysql(MySQLDialect_mysqldb):
45
description_encoding = None
46
supports_sane_rowcount = False
48
colspecs = util.update_copy(
49
MySQLDialect.colspecs,
57
return __import__('cymysql')
59
def _extract_error_code(self, exception):
60
return exception.errno
62
def is_disconnect(self, e, connection, cursor):
63
if isinstance(e, self.dbapi.OperationalError):
64
return self._extract_error_code(e) in \
65
(2006, 2013, 2014, 2045, 2055)
66
elif isinstance(e, self.dbapi.InterfaceError):
67
# if underlying connection is closed,
68
# this is the error you get
73
dialect = MySQLDialect_cymysql