Bug #56731 Second SQLSetPos(Update) not posting update to database
Submitted: 11 Sep 2010 14:43 Modified: 29 Jun 2015 10:35
Reporter: Jim Dickenson Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1.6 OS:MacOS (likely other OSes)
Assigned to: Assigned Account CPU Architecture:Any
Tags: ODBC, SQLSetPos

[11 Sep 2010 14:43] Jim Dickenson
Description:
If one fetches a row and changes the contents of the primary key field with a call to SQLSetPos(Update) and then tries to post a second change right after that with another call to SQLSetPos(Update) there is no error returned but the data does not end up being posted to the database.

      else if (strcmp(items[0].odbc_data, "4") == 0) {
         items[0].ret_wid = SQL_NTS; 
         items[1].ret_wid = SQL_COLUMN_IGNORE;
         memmove(items[0].odbc_data, "0055", 5);
         rc = SQLSetPos(StmtHandle, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE);
         if (rc != SQL_SUCCESS) {
            printf("SQLSetPos(update) failed %d\n", rc);
            odbc_show_error_info(SQL_HANDLE_STMT, StmtHandle);
            goto close_down; }
         rc = SQLEndTran(SQL_HANDLE_DBC, DBCHandle, SQL_COMMIT);
         if (rc != SQL_SUCCESS) {
            printf("SQLEndTran(update) failed %d\n", rc);
            odbc_show_error_info(SQL_HANDLE_DBC, DBCHandle);
            goto close_down; }  
         printf("!!!First Updated!!!\n\n");
         items[0].ret_wid = SQL_NTS; 
         items[1].ret_wid = SQL_COLUMN_IGNORE;
         memmove(items[0].odbc_data, "9055", 5);
         rc = SQLSetPos(StmtHandle, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE);
         if (rc != SQL_SUCCESS) {
            printf("SQLSetPos(update) failed %d\n", rc);
            odbc_show_error_info(SQL_HANDLE_STMT, StmtHandle);
            goto close_down; }
         rc = SQLEndTran(SQL_HANDLE_DBC, DBCHandle, SQL_COMMIT);
         if (rc != SQL_SUCCESS) {
            printf("SQLEndTran(update) failed %d\n", rc);
            odbc_show_error_info(SQL_HANDLE_DBC, DBCHandle);
            goto close_down; }  
         printf("!!!Second Update Updated!!!\n\n"); }

How to repeat:
Run the above code

Suggested fix:
Figure out why the data is not posted to the database and fix it so that data is posted.
[3 Jan 2011 11:12] Tonci Grgin
Assigning to Lawrin.
[29 May 2015 10:35] Chiranjeevi Battula
Hello Jim Dickenson,

Thank you for the bug report.
I could not repeat this issue at my end with the provided information.
Could you please provide complete repeatable test case to confirm this issue at our end?

Thanks,
Chiranjeevi.
[30 Jun 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".