Bug #719 When adding a record with insertRow(), old row stays in the dataset
Submitted: 25 Jun 2003 8:06 Modified: 28 Mar 2014 11:42
Reporter: David Marquis Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1 OS:Windows (Win2k)
Assigned to: Alexander Soklakov CPU Architecture:Any

[25 Jun 2003 8:06] David Marquis
Description:
When adding a record with moveToInsertRow() + updateXXX() + insertRow(), the old row (without auto-incremented keys) stays in the resultset, usually as the first record.

It looks like rowData somehow contains the old row and the new one (see insertRow() in UpdatableResultSet)

How to repeat:
CREATE TABLE test
(
  id int auto_increment primary key,
  field varchar(32)
) Type=MyISAM;

ResulSet set = conn.getStatement().execute("some select sql");

set.moveToInsertRow();
set.updateString("field", "value");
set.insertRow();

set.first();

while(set.next())
{
    System.out.println( set.getInt("id") );
    System.out.println( set.getString("field") );
}

// 'value' will be printed twice, and id will be NULL for one row, and the other row will have the auto-generated primary key.
[26 Jun 2003 7:27] Mark Matthews
I can't repeat this behavior. Can you please submit a test case that loads the table with the data that causes this behavior, and has full functionality (the one you submitted in this bug report isn't complete, and is pseudocode in some spots, thus I had to make assumptions about some of the things you are doing, and it is possible to assume wrong things).
[7 Aug 2003 15:18] Mark Matthews
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
[28 Mar 2014 11:42] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.