Subject Re: [IBO] IBOQuery.open Crashes IBServer on 27th open
Author Svein Erling Tysvær
Huh?

>Select DISTINCT
>Agency_Form.Form_ID,
>Agency_Form.Agency_ID,
>Agency_Form.File_Quarterly,
>Agency_Form.File_Annually,
>Agency_Form.Prior_DayCount,
>Agency_Form.OnlyIf_EFT
>From Payment LEFT OUTER JOIN Client_Agency
>ON Payment.Agency_ID = Client_Agency.Agency_ID
>INNER JOIN Agency_Form
>ON Payment.Agency_ID = Agency_Form.Agency_ID
>Where
>Payment.Client_ID = :ClientID
>And Payment.Check_Date Between :FromDate AND :ToDate
>And Agency_Form.File_Quarterly = 'YES'
>And Payment.Status = 'VALID'
>And Client_Agency.Client_ID IS NULL

What is the point with a left outer join when you don't return anything
from the right table? From my understanding this isn't even valid SQL -
you're not supposed to have anything from the right table in the where
clause when doing a left outer join (Interbase 5.5 programmers guide page
153).

To make it legal SQL, change it to

Select DISTINCT
Agency_Form.Form_ID,
Agency_Form.Agency_ID,
Agency_Form.File_Quarterly,
Agency_Form.File_Annually,
Agency_Form.Prior_DayCount,
Agency_Form.OnlyIf_EFT
From Payment LEFT OUTER JOIN Client_Agency
ON Payment.Agency_ID = Client_Agency.Agency_ID And Client_Agency.Client_ID
IS NULL
INNER JOIN Agency_Form
ON Payment.Agency_ID = Agency_Form.Agency_ID
Where
Payment.Client_ID = :ClientID
And Payment.Check_Date Between :FromDate AND :ToDate
And Agency_Form.File_Quarterly = 'YES'
And Payment.Status = 'VALID'

But I don't think the left outer join actually does anything, and that

Select DISTINCT
Agency_Form.Form_ID,
Agency_Form.Agency_ID,
Agency_Form.File_Quarterly,
Agency_Form.File_Annually,
Agency_Form.Prior_DayCount,
Agency_Form.OnlyIf_EFT
From Payment
INNER JOIN Agency_Form
ON Payment.Agency_ID = Agency_Form.Agency_ID
Where
Payment.Client_ID = :ClientID
And Payment.Check_Date Between :FromDate AND :ToDate
And Agency_Form.File_Quarterly = 'YES'
And Payment.Status = 'VALID'

will return exactly the same.

Seems like IBO has revealed a problem with your code that the BDE didn't
bother to do. Though I must admit that it would have been better if it
complained during prepare than by crashing the IB server.

HTH,
Set