EDatabaseError

JuergenD

Member
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

Code:
// Exeute it!
        DMLQuery.Execute;
some commands for setting the RowId are executed.

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;
after that it is checked if some rows are affected.

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));
In our case a database error is raised and the program jumps to the exception block.

If we put the line

Code:
SaveRecordData(b, FCurRec);
in the exception block no invalid pointer error occurs. We also get no invalid pointer error if we move the check:

Code:
if Updating and (DMLQuery.RowsProcessed = 0) then
          DatabaseError(TranslatedMessage('U', 0, dmRecordDeleted));
directly under the

Code:
DMLQuery.Execute;'
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
 
Can you send me a demo program to reproduce the issue? It's a bit too complex to understand from a few code snippets. If we can reproduce the error, we'll fix it.
 
Hallo Marco Kalter

Thank you very much for your help. Unfortunately we are in a hurry. We dont know if our workaround is correct. Could you please tell us how long it will take you to examine the problem.

Greetings
JuergenD
 
Back
Top