summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2009-01-22 01:46:04 +0000
committerMichael Trier <mtrier@gmail.com>2009-01-22 01:46:04 +0000
commit52e2c2d916fb45d8169d6b273db2b39b0fc8ccee (patch)
tree69445fe6a8ee22ec1eb0e98af222bc18647c3928
parent7c56371f81707b5979249b2f2b056f65488f1bab (diff)
downloadsqlalchemy-52e2c2d916fb45d8169d6b273db2b39b0fc8ccee.tar.gz
Restored convert_unicode handling on mssql. Fixes #1291.
-rw-r--r--CHANGES6
-rw-r--r--lib/sqlalchemy/databases/mssql.py3
-rwxr-xr-xtest/dialect/mssql.py23
3 files changed, 28 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 5ff51fa8c..164d92b0b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -29,7 +29,11 @@ CHANGES
- sql
- Further fixes to the "percent signs and spaces in column/table
names" functionality. [ticket:1284]
-
+
+- mssql
+ - Restored convert_unicode handling. Results were being passed
+ on through without conversion. [ticket:1291]
+
0.5.1
========
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 24296c329..1a3c20a07 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -308,9 +308,6 @@ class _StringType(object):
else:
return None
- def result_processor(self, dialect):
- return None
-
class MSNumeric(sqltypes.Numeric):
def result_processor(self, dialect):
diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py
index f0b0bec76..08ddfd5a1 100755
--- a/test/dialect/mssql.py
+++ b/test/dialect/mssql.py
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8
import testenv; testenv.configure_for_tests()
import datetime, os, pickleable, re
from sqlalchemy import *
@@ -144,6 +145,28 @@ class ReflectionTest(TestBase):
table.drop()
+class QueryUnicodeTest(TestBase):
+ __only_on__ = 'mssql'
+
+ def test_convert_unicode(self):
+ meta = MetaData(testing.db)
+ t1 = Table('unitest_table', meta,
+ Column('id', Integer, primary_key=True),
+ Column('descr', mssql.MSText(200, convert_unicode=True)))
+ meta.create_all()
+ con = testing.db.connect()
+
+ # encode in UTF-8 (sting object) because this is the default dialect encoding
+ con.execute(u"insert into unitest_table values ('bien mangé')".encode('UTF-8'))
+
+ try:
+ r = t1.select().execute().fetchone()
+ assert isinstance(r[1], unicode), '%s is %s instead of unicode, working on %s' % (
+ r[1], type(r[1]), meta.bind)
+
+ finally:
+ meta.drop_all()
+
class QueryTest(TestBase):
__only_on__ = 'mssql'