tmolomby / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

error when the string length of 11 characters #220

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. My model:

{{{
class Citizen(models.Model):
    class Meta:
        db_table = 'f2'

    famil = models.CharField(u'Фамилия', max_length=50)
    imja = models.CharField(u'Имя', max_length=50)
    otch = models.CharField(u'Отчество', max_length=50)
}}}

2. Settings:

{{{
'asp': {
        'ENGINE': 'sql_server.pyodbc', 
        'NAME': 'ASPikr_Detskie',                      
        'USER': '***',                      
        'PASSWORD': '***',                  
        'OPTIONS': {
            'dsn': 'ASP_Zapret',
            'collation': 'Cyrillic_General_CI_AS',
            'unicode_results': True,
        }
}}}

3. execution of the next query, if any of the options has a length of 11 
characters:

{{{
results = Citizen.objects.filter(famil__startswith=data['last_name'])

            if data['first_name']:
                results = results.filter(imja__startswith=data['first_name'])
            if data['patronymic']:
                results = results.filter(otch__startswith=data['patronymic'])
}}}

leads to an error:

{{{
/lib64/libc.so.6(+0x72a66)[0x7fe858ce4a66]
/lib64/libc.so.6(+0x75afb)[0x7fe858ce7afb]
/lib64/libc.so.6(__libc_malloc+0x70)[0x7fe858ce98e0]
/usr/lib/libtdsodbc.so(+0x180cc)[0x7fe8520740cc]
/usr/lib/libtdsodbc.so(+0x9c8b)[0x7fe852065c8b]
/usr/lib64/libodbc.so.1(SQLBindParameter+0x169)[0x7fe8529dc089]
/usr/lib64/python2.7/site-packages/pyodbc.so(_Z13BindParameterP6CursorlR9ParamIn
fo+0x7e)[0x7fe852                          c4869e]
/usr/lib64/python2.7/site-packages/pyodbc.so(_Z14PrepareAndBindP6CursorP7_object
S2_b+0x3d3)[0x7fe                          852c48ae3]
/usr/lib64/python2.7/site-packages/pyodbc.so(+0xc671)[0x7fe852c46671]
}}}

Full trace in attachment.

My system:

{{{
 # uname -a
Linux dc 2.6.39.4-calculate #2 SMP Mon Aug 15 13:17:53 MSD 2011 x86_64 Intel(R) 
Pentium(R) 4 CPU 3.06GHz GenuineIntel GNU/Linux
}}}

pyodbc-2.1.11
freetds-0.91
python-2.7.1-r1
django-1.3.1

Original issue reported on code.google.com by r...@proscript.ru on 19 Oct 2011 at 12:12

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 3 Nov 2011 at 1:48

GoogleCodeExporter commented 9 years ago
Fixed in 3.0.x

Verified on OS/X 10.8 (Mountain Lion) & SQL Server 2012 using the 
freetdstests.py unit tests in the tests2 directory.

Original comment by mkleehammer on 27 Sep 2012 at 10:21