wmjie / ibm-db

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

ibm_db.fetch_tuple returns previous value instead of empty value #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I make a query, a column value of a row is replaced by previuos value if 
current value is empty. This issue doesn't occur if a non empty value is 
present.

see following steps for explanation

What steps will reproduce the problem?
>>> import ibm_db
>>> ibm_db_conn = ibm_db.connect('XXX', 'XX', 'XXX')
>>> stmt = ibm_db.exec_immediate(dbcon, "SELECT STATEMENT...")
>>> ibm_db.fetch_tuple(stmt)
(196L, '2012-07-23', u'Comunicazione 2011 - 6 bis', u'', '2011-01-01', None, 1, 
None, u'comunicazioni/2011/Comunicazione 2011 - 6 bis.pdf', u'', 195L, 196L, 5L)
>>> ibm_db.fetch_tuple(stmt)
(195L, '2012-07-23', u'Comunicazione 2011 - 4', u'test', '2011-01-01', None, 1, 
u'', u'comunicazioni/2011/Comunicazione2011 - 4.pdf', u'', 221L, 195L, 5L)
>>> ibm_db.fetch_tuple(stmt)
(194L, '2012-07-23', u'Comunicazione 2011 - 3', u'test', '2011-01-01', None, 1, 
None, u'comunicazioni/2011/Comunicazione 2011 - 3.pdf', u'', 193L, 194L, 5L)
>>> ibm_db.fetch_tuple(stmt)
(202L, '2012-07-23', u'COMUNICAZIONE 2012 - 1', u'wewewe', '2012-01-01', None, 
1, u'', u'comunicazioni/2012/COMUNICAZIONE 2012 - 1.pdf', u'', 222L, 202L, 5L)

What is the expected output? What do you see instead?
when I fetch new row, instaead of u'test' I expect u''.
This issue doesn't occur when a non empty value is present on the column
When row with u'test' is fetched, following row has u'test' value even if on 
database is u''. If not empty value is present, no issue occurs.

What version of the product are you using? On what operating system?
>>> ibm_db.__version__
'1.0.6'
Windows Server 2008 r2 - Client DB2 9.5.0 

Original issue reported on code.google.com by marcoi...@gmail.com on 17 Sep 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Another information.
The column type where issue occurs is CLOB (in django model is 
testo = models.TextField(max_length=4096, blank=True, null=True)
)

Thanks

Original comment by marcoi...@gmail.com on 17 Sep 2012 at 12:55

GoogleCodeExporter commented 9 years ago
I am able to reproduce this issue and working on the same.

Original comment by rahul.pr...@in.ibm.com on 18 Sep 2012 at 11:54

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 18 Sep 2012 at 11:54

GoogleCodeExporter commented 9 years ago
I have created a patch for this issue, and it is working fine with our initial 
testing.

Please find that patched ibm_db.c file in the attachment, please give a try to 
this patch and let us know how it goes.

Original comment by rahul.pr...@in.ibm.com on 17 Dec 2012 at 10:15

Attachments:

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

Original comment by rahul.pr...@in.ibm.com on 17 Dec 2012 at 10:17

GoogleCodeExporter commented 9 years ago
I have make the patch on above ibm_db-2.0.0 so, please use 2.0.0 version of 
ibm_db and replace the existing ibm_db.c with patched one. 

Original comment by rahul.pr...@in.ibm.com on 17 Dec 2012 at 10:20

GoogleCodeExporter commented 9 years ago
I can confirm that this is working correctly with the patched version.  I 
tested it both locally using ibm_db and then on another system using 
ibm_db_django to test the patch.

Thanks

Eric

Original comment by eric.per...@gmail.com on 17 Dec 2012 at 4:28

GoogleCodeExporter commented 9 years ago
Fixed in ibm_db-2.0.1 release.

Original comment by rahul.pr...@in.ibm.com on 1 Mar 2013 at 10:25