Subject | Re: [IBO] App Errors with IBO and FB1.5 |
---|---|
Author | rgarbig |
Post date | 2004-05-10T14:32:06Z |
The application uses the TIB_Session (sesTrs), TIBODatabase (dbTrs)
and TIBOQuery components with implicit transaction control. I use the
TIBODatabase for connecting to FB. Forced writes is true, isolation
is tiCommitted, protocol is TCP/IP, server is localhost.dbTrs session
is sesTrs.
All queries sesion = sesTrs.
Here is the sql and code.
// pass in dt_PK
function fReserveTime(line_no, intDTPK, time1, Tee, Num_Players,
CallerCode: integer;
strGroupID : String; date1: TDateTime;
ResNum : Integer;
course, j, flag1, round : Integer): Boolean;
// j is for the index to start adding players
from
// examples, if there are 3 players, and
// I want to add 1, I go from 3 to 4
// flag is if we are booking, or modifying
var
intResvdt_PK, timetaken, intGuests : Integer;
i, k, intAccessCode, intNumPlayers, intCarts : Integer;
strAccess : string[8];
strCategory, strGender, strPlayerName : string;
begin
debug_info(line_no, 'fReserveTime', 1);
debug_info(line_no, 'fReserveTime DTPK ' + inttostr(intDTPK), 2);
debug_info(line_no, 'fReserveTime ResNum ' + inttostr(resnum), 2);
debug_info(line_no, 'fReserveTime Players ' + inttostr
(num_players), 2);
debug_info(line_no, 'fReserveTime Player index Start at ' + inttostr
(j+1), 2);
debug_info(line_no, 'fReserveTime ' + pad_string(inttostr(time1)),
23);
//--------------------------------------------------------------------
----------
fReserveTime := True;
//Query settings: ib_Connection: dbTrs, ib_Transaction: default,
keylinks: resvdt.resvdt_pk, requestlive = True
//commit action = invalidate cursor
with dmTRS.qryReserveTime do begin
close;
sql.clear;
sql.add('select resvdt_PK, course_no, resv_date, resv_time,
hole_number');
sql.add(', groupID, time_taken_front, lock_field, guests from
resvdt');
sql.add(' where resvdt_pk = ' + inttostr(intDTPK));
open;
try
if (not eof) then begin
intResvdt_PK := fieldbyname('Resvdt_PK').asinteger;
timetaken := FieldByName('TIME_TAKEN_FRONT').AsInteger;
if ((num_players + timetaken) > giMaxGroupSize) then begin
fReserveTime := False;
close;
debug_info(line_no, 'fReserveTime Timetaken error ', 1514);
WriteLn(MyErrorLog, 'Udbrk - fReserveTime: NumPlayers > 4,
1514');
Exit;
end;
intGuests := FieldByName('Guests').AsInteger;
Edit;
FieldByName('TIME_TAKEN_FRONT').AsInteger := (num_players +
timetaken);
FieldByName('Guests').AsInteger := intGuests + PLine[Line_No]
^.NumGuests;
FieldByName('LOCK_FIELD').AsInteger := 0;
Post; // qryReserveTime
end
else begin
close;
WriteLn(MyErrorLog, 'udbrk fReserveTime resvdt - nofind');
fReserveTime := False;
exit;
end;
except
close;
WriteLn(MyErrorLog, 'udbrk fReserveTime - Clear Lock_field
failed');
fReserveTime := False;
raise;
end;
close;
debug_info(line_no, 'Reserve_Time', 52);
pUpdate_Counter(line_no, course, date1, 1);
end; // with qryReserveTime
dmTrs.dbTrs.commit;
and TIBOQuery components with implicit transaction control. I use the
TIBODatabase for connecting to FB. Forced writes is true, isolation
is tiCommitted, protocol is TCP/IP, server is localhost.dbTrs session
is sesTrs.
All queries sesion = sesTrs.
Here is the sql and code.
// pass in dt_PK
function fReserveTime(line_no, intDTPK, time1, Tee, Num_Players,
CallerCode: integer;
strGroupID : String; date1: TDateTime;
ResNum : Integer;
course, j, flag1, round : Integer): Boolean;
// j is for the index to start adding players
from
// examples, if there are 3 players, and
// I want to add 1, I go from 3 to 4
// flag is if we are booking, or modifying
var
intResvdt_PK, timetaken, intGuests : Integer;
i, k, intAccessCode, intNumPlayers, intCarts : Integer;
strAccess : string[8];
strCategory, strGender, strPlayerName : string;
begin
debug_info(line_no, 'fReserveTime', 1);
debug_info(line_no, 'fReserveTime DTPK ' + inttostr(intDTPK), 2);
debug_info(line_no, 'fReserveTime ResNum ' + inttostr(resnum), 2);
debug_info(line_no, 'fReserveTime Players ' + inttostr
(num_players), 2);
debug_info(line_no, 'fReserveTime Player index Start at ' + inttostr
(j+1), 2);
debug_info(line_no, 'fReserveTime ' + pad_string(inttostr(time1)),
23);
//--------------------------------------------------------------------
----------
fReserveTime := True;
//Query settings: ib_Connection: dbTrs, ib_Transaction: default,
keylinks: resvdt.resvdt_pk, requestlive = True
//commit action = invalidate cursor
with dmTRS.qryReserveTime do begin
close;
sql.clear;
sql.add('select resvdt_PK, course_no, resv_date, resv_time,
hole_number');
sql.add(', groupID, time_taken_front, lock_field, guests from
resvdt');
sql.add(' where resvdt_pk = ' + inttostr(intDTPK));
open;
try
if (not eof) then begin
intResvdt_PK := fieldbyname('Resvdt_PK').asinteger;
timetaken := FieldByName('TIME_TAKEN_FRONT').AsInteger;
if ((num_players + timetaken) > giMaxGroupSize) then begin
fReserveTime := False;
close;
debug_info(line_no, 'fReserveTime Timetaken error ', 1514);
WriteLn(MyErrorLog, 'Udbrk - fReserveTime: NumPlayers > 4,
1514');
Exit;
end;
intGuests := FieldByName('Guests').AsInteger;
Edit;
FieldByName('TIME_TAKEN_FRONT').AsInteger := (num_players +
timetaken);
FieldByName('Guests').AsInteger := intGuests + PLine[Line_No]
^.NumGuests;
FieldByName('LOCK_FIELD').AsInteger := 0;
Post; // qryReserveTime
end
else begin
close;
WriteLn(MyErrorLog, 'udbrk fReserveTime resvdt - nofind');
fReserveTime := False;
exit;
end;
except
close;
WriteLn(MyErrorLog, 'udbrk fReserveTime - Clear Lock_field
failed');
fReserveTime := False;
raise;
end;
close;
debug_info(line_no, 'Reserve_Time', 52);
pUpdate_Counter(line_no, course, date1, 1);
end; // with qryReserveTime
dmTrs.dbTrs.commit;
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 11:02 AM 10/05/2004 +0000, you wrote:
> >I posted this on firebird-suppport but didn't get a response. Sorry
> >if this would be considered a double post but I need the help.
Thanks.
> >
> >Testing my converted app with FB1.5 (originally Paradox then IB)
and
> >IBO 4.3.A. Using TIBO components and implicit transaction control
> >with db commits after inserts and updates. AutoCommit is true.
> >
> >Error 1: "Multiple rows in singleton fetch" The select statement is
> >requesting one row and the key is the primary key field? Keylinks
is
> >the primary key field. What does this mean and what would cause
this?
>
> Show the exact SQL.
>
>
> >Error 2: ISC ERROR CODE:335544332 Invalid transaction handle
> >(expecting explicit transaction start)? from an update query
setting
> >one field to zero with the primary key field as the key.
> >Keylinks is the primary key field.
>
> 1. Show us the SQL of the statement.
> 2. Show us the code that you use to execute the statement.
> 3. Tell us about the ib_connection and ib_transaction settings of
the
> statement objects.
>
> Helen