Bug #22796 my_setpos_delete_ignore() test fails
Submitted: 28 Sep 2006 18:17 Modified: 27 Feb 2007 14:03
Reporter: Jim Winstead Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51r115 OS:Linux (Linux, x86_64)
Assigned to: Jim Winstead
Tags: SQL_DELETE, SQLSetPos

[28 Sep 2006 18:17] Jim Winstead
Description:
my_setpos_delete_ignore() in test/dyn_cursor/my_dyn_cursor.c crashes.

Work was started to diagnose this bug, and committed here: http://svn.mysql.com/fisheye/changelog/connector-odbc3/trunk?cs=46

How to repeat:
Re-enable the test, and run it.

Back trace:

#0  0x00002aaaaabd5c21 in insert_fields (stmt=0x597440, 
    dynQuery=0x7fffffa271d0) at cursor.c:668
#1  0x00002aaaaabd5dac in build_where_clause (pStmt=0x597440, 
    dynQuery=0x7fffffa271d0, irow=1) at cursor.c:719
#2  0x00002aaaaabd6477 in setpos_delete (stmt=0x597440, irow=0, 
    dynQuery=0x7fffffa271d0) at cursor.c:974
#3  0x00002aaaaabd7039 in my_SQLSetPos (hstmt=0x597440, irow=0, 
    fOption=<value optimized out>, fLock=0) at cursor.c:1294
#4  0x00002aaaaabd7a26 in SQLSetPos (hstmt=0x587b18, irow=46912513539088, 
    fOption=0, fLock=0) at cursor.c:1469
#5  0x0000000000404b10 in my_setpos_delete_ignore (hdbc=0x587240, 
    hstmt=0x597440) at dyn_cursor/my_dyn_cursor.c:357
#6  0x0000000000408f80 in main (argc=1, argv=0x7fffffa275a8)
    at dyn_cursor/my_dyn_cursor.c:1048

Suggested fix:
It looks like the logic of insert_fields() in myodbc3/cursor.c is wrong. It looks like it is trying to do something clever using the results of a "SELECT * FROM table LIMIT  0" query to know how to update all columns, but then not dealing with the fact that such a query will return no rows of data.
[28 Sep 2006 18:25] Jim Winstead
There are additional tests that fail -- see http://lists.mysql.com/commits/12757
[13 Feb 2007 1:08] Jim Winstead
Rewrite (and rename) of insert_fields() so that it actually works

Attachment: diff (application/octet-stream, text), 14.71 KiB.

[22 Feb 2007 17:26] Jim Winstead
Fix has been committed (r212), will be in the next C/ODBC 3.51 release.
[27 Feb 2007 14:03] MC Brown
A note has been added to the 3.51.14 changelog.