Hello,
by using the Oracle 'Virtual Private Database' we had the following problem.
If a user hasn't got the right updating a record but he tries to update it, Oracle ignores the request and the record is not changed. By using the TOracleDataSet-Class for updating a record we get the followig error message. 'Record has been deleted by another user.' If we close the DataSet we get an invalid pointer operation and the application becomes instable. After analyzing the problem we came to the result that the exception handling in TOracleDataSet.InternalInsertUpdate is not correct.
After execution of the Query
some commands for setting the RowId are executed.
after that it is checked if some rows are affected.
In our case a database error is raised and the program jumps to the exception block.
If we put the line
in the exception block no invalid pointer error occurs. We also get no invalid pointer error if we move the check:
directly under the
line.
We assume that the 'SetRowId(.. ' only should be executed, if it can be ensured that the Command SaveRecordData(b, FCurRec) will be executed later. By moving the RowsProcessed-Check direcly under the Query-Execution 'SetRowId(.. ' will not be executed in case of an error.
Now our Questions.
Is this bug known?
Does any workaround exists for this problem?
When can we reckon on a version without this error?
Greetings
JuergenD
by using the Oracle 'Virtual Private Database' we had the following problem.
If a user hasn't got the right updating a record but he tries to update it, Oracle ignores the request and the record is not changed. By using the TOracleDataSet-Class for updating a record we get the followig error message. 'Record has been deleted by another user.' If we close the DataSet we get an invalid pointer operation and the application becomes instable. After analyzing the problem we came to the result that the exception handling in TOracleDataSet.InternalInsertUpdate is not correct.
After execution of the Query
Code:
// Exeute it!
DMLQuery.Execute;
Code:
// If Inserting, save the new RowId
// if Inserting then
begin
if (not Session.POLite) and (TrimRight(FUniqueFields) = '') then
begin
if Session.UseOCI80 then
SetRowId(b, PChar(string(DMLQuery.GetVariable('doa__rowid'))))
else begin
if Inserting then SetRowId(b, PChar(DMLQuery.RowId));
end;
end else
if Inserting then SetRowId(b, PChar(FetchRowId(False)));
end;
Code:
// If updating and no rows were affected, the record has been deleted
if Updating and (DMLQuery.RowsProcessed = 0) then
DatabaseError(TranslatedMessage('U', 0, dmRecordDeleted));
If we put the line
Code:
SaveRecordData(b, FCurRec);
Code:
if Updating and (DMLQuery.RowsProcessed = 0) then
DatabaseError(TranslatedMessage('U', 0, dmRecordDeleted));
Code:
DMLQuery.Execute;'
We assume that the 'SetRowId(.. ' only should be executed, if it can be ensured that the Command SaveRecordData(b, FCurRec) will be executed later. By moving the RowsProcessed-Check direcly under the Query-Execution 'SetRowId(.. ' will not be executed in case of an error.
Now our Questions.
Is this bug known?
Does any workaround exists for this problem?
When can we reckon on a version without this error?
Greetings
JuergenD