Subject | Open vs. First |
---|---|
Author | Dennis McFall |
Post date | 2004-11-15T03:58:42Z |
I have lots of scenarios where I do an SQL (may be complex) and then work
Is there any reason why "First" instead of just "Open"?
For example, would you advise against this kind of code (for any
reason?) (curSomeData is a TIB_Cursor component in a Delphi app, with
the SQL property assigned at design time.)
procedure SomeProcedure(iParam:integer);
begin
with curSomeData do try
if not prepared then prepare;
Params[0].AsInteger := iParam;
Open;
if not eof then while not eof do begin
Next;
end;
finally
close;
end;
end;
Is there any need/reason to unprepare?
Thanks.
Dennis McFall
>>with the results, however I often want to check that a record has beenHelen:
>>returned. My code has used recordCount for this, however I believe that to
>>do this with IBO components the components must run an SQL with the
>>equivalent of a Count(). I don't want to do this. What is the best
>>alternative, just check EOF?
>>
>>
>
>Never use counts!! Use the IsEmpty property for queries; for ib_cursors,
>call First and then check EOF.
>
>
>
>
Is there any reason why "First" instead of just "Open"?
For example, would you advise against this kind of code (for any
reason?) (curSomeData is a TIB_Cursor component in a Delphi app, with
the SQL property assigned at design time.)
procedure SomeProcedure(iParam:integer);
begin
with curSomeData do try
if not prepared then prepare;
Params[0].AsInteger := iParam;
Open;
if not eof then while not eof do begin
Next;
end;
finally
close;
end;
end;
Is there any need/reason to unprepare?
Thanks.
Dennis McFall