Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
'Duplicate Record' overwrites existing record #1255
Details for the issue
INSERT INTO Table1 (
The first query (the 'INSERT INTO ...') fails (correct, because the empty field-value for 'Date' does not pass the check) but the program continues. Therefore it updates the wrong record (overwriting an existing record)
Useful extra information
I'm opening this issue because:
I'm using DB4S on:
I'm using DB4S version:
I have also:
Ideal query would be
If the column is not auto increment, then all we can do is to blindly duplicate the row. It will then throw an error as the primary key is already taken.
I don't understand
I Need to walkthrough its code.
Correct me if I am wrong.
added a commit
Dec 10, 2017
The error in the first step, inserting an empty row, was ignored. I've improved that, by checking the error and aborting with the message to the user. Now the overwrite does not occur, that is the most important issue.
This doesn't improve the underlying situation, that is inserting empty rows before duplicating the content. But it is safer to not ignore the error in the initial row insertion.
Hmmm, I wonder if the reason it's inserting an empty row, is something to do with the way we do "Create a new Record?". (bad cut-n-paste maybe for initial duplication code?)
From memory, when the user presses the "Create new record" button, we insert an empty row first for some reason. I think that's to make sure any default values for fields get created, and we can populate them into the row data fields onscreen for the user. That's purely from really old memory of how I remember it being explained one time. So... don't take that as definitely 100% correct.