Subject AV in TIBOQuery and TIB_Query
Author Daniel Rail
Hi,

I'm using Delphi 5 and IBO 4.2Hj. And, I apologize for the long post.

Before I was using 4.2Gc.

Since I've upgraded to 4.2Hj, I'm getting an AV error with a particular
query when using TIBOQuery and TIB_Query. And the error occurs on the
prepare. If I put the same query in TIB_Cursor, everything works fine.

Here's the query(it contains sub-selects and multiple parameters):

SELECT
Clients.ClientNo,
(SELECT FULLNAME
from clientfullname_1(1, Clients.clientno)) as FullName,
Clients.PhoneHome,
(SELECT
SUM(Clientorder.Balance_Due)
FROM Clientorder
WHERE (clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate BETWEEN (:PDate)-30 AND :PDate)
AND (Clientorder.Balance_Due<>0)
and (clientorder.docno=:docno)) as CURRENT_30,
(SELECT
SUM(Clientorder.Balance_Due)
FROM Clientorder
WHERE (clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate BETWEEN (:PDate)-60 AND (:PDate)-31)
AND (Clientorder.Balance_Due<>0)
and (clientorder.docno=:docno)) as CURRENT_60,
(SELECT
SUM(Clientorder.Balance_Due)
FROM Clientorder
WHERE (clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate BETWEEN (:PDate)-90 AND (:PDate)-61)
AND (Clientorder.Balance_Due<>0)
and (clientorder.docno=:docno)) as CURRENT_90,
(SELECT
SUM(Clientorder.Balance_Due)
FROM Clientorder
WHERE (clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate <= (:PDate)-91)
AND (Clientorder.Balance_Due<>0)
and (clientorder.docno=:docno)) as CURRENT_91,
(SELECT
SUM(Clientorder.Balance_Due)
FROM Clientorder
WHERE (clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate <= :PDate)
AND (Clientorder.Balance_Due<>0)
and (clientorder.docno=:docno)) as ClientBalanceDue
FROM Clients
WHERE EXISTS (SELECT CLIENTORDER.CLIENTNO
FROM CLIENTORDER
WHERE (Clientorder.clientno=clients.clientno)
and (Clientorder.InvoiceDate <= :PDate)
AND (clientorder.balance_due<>0)
and (clientorder.docno=:docno))
ORDER BY Clients.lastname, clients.firstname, clients.middlename


Here's the call stack:

Exception 'EAccessViolation' in module Filopto41.exe at 0024494B
Access violation at address 4024594B in module 'Filopto41.exe'. Write of
address 00000000

Source file: IBA_BDataset.IMP, Line 40269

Call stack:
:4024594B [Filopto41.exe] Ib_components.TIB_Row.SysClearBuffers
(IBA_BDataset.IMP, line 40269)
:402437E8 [Filopto41.exe] Ib_components.TIB_Row.SysUpdate
(IBA_BDataset.IMP, line 39436)
:40222504 [Filopto41.exe] Ib_components.TIB_Statement.SysUpdateDescriptors
(IBA_Statement.IMP, line 2241)
:40229EAF [Filopto41.exe] Ib_components.TIB_Dataset.SysUpdateDescriptors
(IBA_Dataset.IMP, line 2121)
:402209A3 [Filopto41.exe] Ib_components.TIB_Statement.SysExecPrepare
(IBA_Statement.IMP, line 1541)
:40220648 [Filopto41.exe] Ib_components.TIB_Statement.SysPrepare
(IBA_Statement.IMP, line 1443)
:4022A50E [Filopto41.exe] Ib_components.TIB_Dataset.SysPrepare
(IBA_Dataset.IMP, line 2279)
:4021F806 [Filopto41.exe] Ib_components.TIB_Statement.Prepare
(IBA_Statement.IMP, line 1037)
:40236D3B [Filopto41.exe] Ib_components.TIB_BDataset.SysUpdateDescriptors
(IBA_BDataset.IMP, line 33405)
:402209A3 [Filopto41.exe] Ib_components.TIB_Statement.SysExecPrepare
(IBA_Statement.IMP, line 1541)
:40220648 [Filopto41.exe] Ib_components.TIB_Statement.SysPrepare
(IBA_Statement.IMP, line 1443)
:4022A50E [Filopto41.exe] Ib_components.TIB_Dataset.SysPrepare
(IBA_Dataset.IMP, line 2279)
:4021F806 [Filopto41.exe] Ib_components.TIB_Statement.Prepare
(IBA_Statement.IMP, line 1037)
:40267C12 [Filopto41.exe] Ibodataset.TIBODataset.Prepare (IBODataset.pas,
line 4760)
:4045384F [Filopto41.exe] Paiementdmu.TPaiementDM.DataModuleCreate
(PaiementDMu.pas, line 458)
:400579C6 [Filopto41.exe] Forms.TDataModule.DoCreate
:4005781E [Filopto41.exe] Forms.TDataModule.Create
:4005A398 [Filopto41.exe] Forms.TApplication.CreateForm
:4051A286 [Filopto41.exe] initialization (Filopto41.dpr, line 250)
:77E9CA90 [kernel32.dll]

I have a similar query with the only difference is that the DOCNO parameter
is omitted and that query gets prepared without errors.

I tried creating a new component and no success. I even dropped a new
TIBOQuery on another form and inserted the query found above and still got
an AV error.

Any ideas on how to get this running again?


Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)