diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/databases/mssql.py | 13 | ||||
-rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 17 | ||||
-rw-r--r-- | lib/sqlalchemy/databases/sqlite.py | 4 |
3 files changed, 32 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 89cc88398..c297195ca 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -143,6 +143,19 @@ class MSBinary(sqltypes.Binary): class MSBoolean(sqltypes.Boolean): def get_col_spec(self): return "BIT" + def convert_result_value(self, value, dialect): + if value is None: + return None + return value and True or False + def convert_bind_param(self, value, dialect): + if value is True: + return 1 + elif value is False: + return 0 + elif value is None: + return None + else: + return value and True or False colspecs = { sqltypes.Integer : MSInteger, diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index e152a4833..997010f1c 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -157,7 +157,7 @@ class MSBinary(sqltypes.Binary): return "BINARY(%d)" % self.length else: return "BLOB" - def convert_result_value(self, value, engine): + def convert_result_value(self, value, dialect): if value is None: return None else: @@ -182,7 +182,20 @@ class MSEnum(sqltypes.String): class MSBoolean(sqltypes.Boolean): def get_col_spec(self): return "BOOLEAN" - + def convert_result_value(self, value, dialect): + if value is None: + return None + return value and True or False + def convert_bind_param(self, value, dialect): + if value is True: + return 1 + elif value is False: + return 0 + elif value is None: + return None + else: + return value and True or False + colspecs = { # sqltypes.BIGinteger : MSInteger, sqltypes.Integer : MSInteger, diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index 2b10a8ad9..c07952ff2 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -79,6 +79,10 @@ class SLBinary(sqltypes.Binary): class SLBoolean(sqltypes.Boolean): def get_col_spec(self): return "BOOLEAN" + def convert_result_value(self, value, dialect): + if value is None: + return None + return value and True or False colspecs = { sqltypes.Integer : SLInteger, |