My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 170 attachment: test_freetds_unicode.py (656 bytes)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sqlalchemy as sa

eng = sa.create_engine("mssql+pyodbc://sa:sa@192.168.200.254/temp?Port=1435&TDS_Version=8.0&ClientCharset=UTF-8")
#eng.echo = True

meta = sa.MetaData()

satest = sa.Table('satest', meta,
sa.Column('a', sa.String(50)),
sa.Column('b', sa.Unicode(50)),
)

meta.drop_all(eng)
meta.create_all(eng)

insval = u'1' * 45
eng.execute(satest.insert().values(a=insval))
print '45 char unicode into string column ok'

insval = u'1' * 44
eng.execute(satest.insert().values(b=insval))
print '44 char unicode into unicode column ok'

# should create segfault
insval = u'1' * 44
eng.execute(satest.insert().values(a=insval))
print 'done'
Powered by Google Project Hosting