strange odac behaviour in TOraQuery -ODAC 6.90.0.54 bcb 2009

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

strange odac behaviour in TOraQuery -ODAC 6.90.0.54 bcb 2009

Post by albourgz » Thu 14 Jan 2010 12:24

I have this table:
SQLWKS> desc cec.threadToRead
Column Name Null? Type
------------------------------ -------- ----
TRIGRAM VARCHAR2(3)
UNPLANNEDTROUBLEID NUMBER(10)

I have a TOraQuery named QRThreadToRead (in datamodule FDM):
sql:
SELECT UNPLANNEDTROUBLEID, ROWID from cec.threadToRead WHERE TRIGRAM=:1
Update sql (delete): DELETE FROM CEC.THREADTOREAD
WHERE
ROWID = :Old_ROWID

If I set param as SLO:
sql>SELECT UNPLANNEDTROUBLEID, count(*) from cec.threadToRead WHERE TRIGRAM='SLO' group by UNPLANNEDTROUBLEID
having count(*)>1;
UNPLANNEDT COUNT(*)
---------- ----------
0 rows selected.


Look at this code:

Code: Select all

if (!FDM->QRThreadToRead->Prepared)
    FDM->QRThreadToRead->Prepare();
FDM->QRThreadToRead->Params->Items[0]->AsString="SLO";
FDM->QRThreadToRead->Active=true;

for (;!FDM->QRThreadToRead->Eof;FDM->QRThreadToRead->Next()) {
       FDM->QRThreadToRead->Delete();
}
In debug, loops fine 6 times without error in FDM->QRThreadToRead->Delete(); statement.
7th execution: exception on FDM->QRThreadToRead->Delete(); statement:
Project cec.exe raised exception class EAssertionFailed with message 'Assertion failure (D:\Projects\Delphi\Dac\Common\Source\MemData.pas, line 7458)'.
What's wrong?????

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 20 Jan 2010 09:26

You don't need to call the Next method in your loop. When you call the Delete method, the query moves to the next record automatically.

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Post by albourgz » Wed 20 Jan 2010 09:55

This would explain only one record on 2 to be deleted.
This doesn't explain the exception!

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 27 Jan 2010 09:51

We could not reproduce the problem. Please send to support*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Post Reply