Subject Re: [IBO] Data Pump: More efficient way?
Author Helen Borrie
At 12:02 AM 6/09/2004 +0000, you wrote:
>Dumb typo on my part. I am actually using TIB_Query from the
>IBoAccess tab, and not TIBQuery from the Interbase tab in Delphi 6.
>Because of your comment, Helen, I looked at all the IBo... tabs that
>were created when I installed IBObjects. Some components have names
>like IB_... and others have IBO.... I just assumed that if a
>component is on an IBo... tab, then it must be an IBObjects object.

IBO is actually two distinct series of components.

-- The TIBO-- ones are the TDataset-compatible ones, that link to Delphi's
TDatasource and, through it, to the VCL data-aware controls and a gazillion
third-party ones.

-- The TIB_-- ones are the IBO "native" components and controls. If a data
access object needs a control to display or operate on data, it links to a
TIB_-- control through TIB_Datasource.

TIB_DSQL and TIB_Cursor (if it doesn't need a data-aware control) can hook
happily to a TIBODatabase and its inbuilt transaction through their
IB_Connection and IB_Transaction properties.

>At any rate, thanks for the suggestion. I will implement right away.
>However, if you would be so kind as to explain the reasons. I assume
>the parameterized query is so it can be prepared, and therefore
>execute faster.

It does execute faster; but the inbuilt DML methods of TIBOQuery and
TIB_Query are also TIB_DSQL internally - TIB_DSQL surfaces this as a
component that you can use when you have to execute prepared statements
from "cooked data", as you are doing.

Parameterising the DML statements is not just faster, saving a lot of
processing cycles in parsing ad hoc SQL and avoiding having to reconstruct
the pieces of the statement when the SQL is replaced repeatedly. It is
also safer, because bad data (wrong type, unexpectedly/undesirably null,
etc.) is detected and can be handled in an exception handler. For your
purposes, it also provides the most robust way to cast imported data.