Subject Version
Author John Tomaselli
Jason,
The following error occurs in a previously working Delphi5/ibo 3.6x version.
Note I'm Currently using D6 and IBO4_2eF and I do have a work-around by
using close/open and not refresh methods.
When I modify a custom search parameter and call the folling code on a
search button the query goes into Insert mode if it has already been open.
Code1: btnEvent
Statement1: What happens if query was closed prior to search
Statement2: What happens if query was opened prior to search. This goes to
insert mode.

TIA
John

Code1:
procedure TfrmReservation.btnSearchNewClick(Sender: TObject);
begin
with dmMain2.IB_Qreservation do
InvalidateSQL;


if not Active then
OPEN else
RefreshAll; {this causes the query to insert mode. }


{ the following code works fine }
if active then
begin
close;
open;
end else
open;



Statment 1
/*---
PREPARE STATEMENT
TR_HANDLE = 25386536
STMT_HANDLE = 25386608

SELECT RESERVATION_ID
FROM RESERVATION RESERVATION
JOIN ORG ORG ON
(ORG.ORG_ID = RESERVATION.ORG_ID)
JOIN MARKET MARKET ON
(MARKET.MARKET_ID = RESERVATION.MARKET_ID)
left join code code on
(RESERVATION.RESERVATION_TYPE_ID = code.code_id)





WHERE MARKET_ID = 124
ORDER BY RESERVATION.RESERVATION_ID DESC

PLAN SORT (JOIN (JOIN (MARKET INDEX (RDB$PRIMARY63),RESERVATION INDEX
(RESERVATION_IDX1),ORG INDEX (RDB$PRIMARY1)),CODE INDEX (RDB$PRIMARY5)))

FIELDS = [ Version 1 SQLd 1 SQLn 30
RESERVATION.RESERVATION_ID = <NIL> ]

SECONDS = 0.010
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 25386536
STMT_HANDLE = 25386608
PARAMS = [ ]
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 25386536
STMT_HANDLE = 25379068
PARAMS = [ Version 1 SQLd 1 SQLn 1
[MLNK_RESERVATION_ID_0] = 7814 ]
----*/
=========================================================================

Statement 2
/*---
PREPARE STATEMENT
TR_HANDLE = 25386536
STMT_HANDLE = 25386608

SELECT RESERVATION_ID
FROM RESERVATION RESERVATION
JOIN ORG ORG ON
(ORG.ORG_ID = RESERVATION.ORG_ID)
JOIN MARKET MARKET ON
(MARKET.MARKET_ID = RESERVATION.MARKET_ID)
left join code code on
(RESERVATION.RESERVATION_TYPE_ID = code.code_id)

WHERE MARKET_ID = 129
ORDER BY RESERVATION.RESERVATION_ID DESC

PLAN SORT (JOIN (JOIN (MARKET INDEX (RDB$PRIMARY63),RESERVATION INDEX
(RESERVATION_IDX1),ORG INDEX (RDB$PRIMARY1)),CODE INDEX (RDB$PRIMARY5)))

FIELDS = [ Version 1 SQLd 1 SQLn 30
RESERVATION.RESERVATION_ID = <NIL> ]

SECONDS = 0.010
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 25386536
STMT_HANDLE = 37634192

SELECT GEN_ID ( GEN_RESERVATION, 1 )
FROM RDB$DATABASE
PLAN (RDB$DATABASE NATURAL)

FIELDS = [ Version 1 SQLd 1 SQLn 1
GEN_ID = 0 ]
----*/