DB2 - Problem description
Problem IT05796 | Status: Closed |
CLI APPLICATION USING CHAINING WITH INSERT BUFFERING MAY GET SQL_SUCCESS BUT SQLROWCOUNT() GIVES 0. | |
product: | |
DB2 CONNECT / DB2CONNCT / A50 - DB2 | |
Problem description: | |
An application that is using CLI insert buffering with chaining to insert the rows more than once on the same statement handle will receive the SQL_SUCCESS when settiing SQL_ATTR_CHAINING_END to end the chain. But SQLRowCount() will return 0 saying no rows inserted. Steps to reproduce problem : ========================== opt echo on opt callerror on quickc 1 1 sample sqlallocstmt 1 1 sqlsetstmtattr 1 SQL_ATTR_INSERT_BUFFERING SQL_ATTR_INSERT_BUFFERING_IGD sqlexecdirect 1 "create table tab1(id char(10) unique not null)" -3 sqlexecdirect 1 "insert into tab1 (id) values ('001')" -3 sqlprepare 1 "insert into tab1 (id) values (?)" SQL_NTS getmem 1 1 SQL_C_CHAR 30 sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0 1 sqlsetstmtattr 1 SQL_ATTR_CHAINING_BEGIN 1 updatemem 1 sql_c_char value SQL_NTS "001" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "001" ### duplicate sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "001" ### duplicate sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "001" ### duplicate sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "001" ### duplicate sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "001" ### duplicate sqlexecute 1 sqlsetstmtattr 1 SQL_ATTR_CHAINING_END 1 sqlrowcount 1 sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0 1 updatemem 1 sql_c_char value SQL_NTS "003" sqlexecute 1 sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0 1 sqlsetstmtattr 1 SQL_ATTR_CHAINING_BEGIN 1 updatemem 1 sql_c_char value SQL_NTS "002" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "004" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "005" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "006" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "007" sqlexecute 1 updatemem 1 sql_c_char value SQL_NTS "008" sqlexecute 1 sqlsetstmtattr 1 SQL_ATTR_CHAINING_END 1 sqlrowcount 1 sqltransact 1 1 sql_rollback sqlfreestmt 1 sql_drop killenv 1 In the above case, first SQL_ATTR_CHAINING_END will fail because all the rows are duplicate and returns the SQLRowCount as 0.(Value returned here depends on the number of rows successfully inserted) But during the 2nd chaining all the rows are good rows, so SQL_ATTR_CHAINING_END should receives SQL_SUCCESS with correct row count. Instead SQLRowCount() API is returning 0 or incorrect result. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 V10.5 FP6 * **************************************************************** | |
Local Fix: | |
NA | |
Solution | |
Please see Above. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 26.11.2014 01.09.2015 01.09.2015 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) | |
10.5.0.6 | |
10.5.0.7 |