wmjie / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

ibm_db_dbi crashes #76

Closed GoogleCodeExporter closed 9 years ago

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

# -*- coding: UTF-8 -*-
import ibm_db_dbi

conn = ibm_db_dbi.connect('DSN=MYDB')
cur=conn.cursor()

cur.execute(u'''create table temp.kill_me
                (
                   dummy varchar(500)
                )
        ''')

# silently crashes app
cur.execute('''
    SELECT 1
    FROM temp.kill_me
    WHERE dummy<>'привет, Индия' ''') # <- any cyrillic text

2. Save .py in UTF-8 encoding

3. Application silently crashes 

What version of the product are you using? On what operating system?
* Tested on DB2 servers: v8.1, v9.5 / Win32 
* DB2 client: v9.5.401.90 / Win32 (Windows 2003)
  ibm_db-1.0.4-py2.6-win32 / cPython 2.6.6

Please provide any additional information below.

Original issue reported on code.google.com by D.V.Selitsky@gmail.com on 25 Jul 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Issue 78 has been merged into this issue.

Original comment by rahul.pr...@in.ibm.com on 28 Jul 2011 at 10:09

GoogleCodeExporter commented 9 years ago
This is happening due to you have send out a string object which contains some 
non ASCII characters, and internally we called PyUnicode_FromObject() API to 
get an Unicode object(from both string and Unicode object) but this API return 
NULL because string object has some non ASCII characters. 

Segmentation fault is happening through PyUnicode_AsUnicode() API because we 
are passing Unicode object which we got by PyUnicode_FromObject() but in your 
case it was NULL.

For the text which contains non ASCII characters must be Unicode by adding 
prefix u'...' or by encoding it by encode() function.

I will apply the check which you have suggested through issue-78 so, it will 
give some relevant Error message instead of segmentation fault.

p.s.
Please not open more than one issue for same kind of problem.

Original comment by rahul.pr...@in.ibm.com on 28 Jul 2011 at 11:05

GoogleCodeExporter commented 9 years ago
Fixed in ibm_db-1.0.5

Original comment by rahul.pr...@in.ibm.com on 20 Jul 2012 at 6:52