Subject | Re: [IBO] Transaction and Datasets |
---|---|
Author | Helen Borrie |
Post date | 2004-04-28T10:42:22Z |
At 05:09 PM 28/04/2004 +0700, you wrote:
properly. There's no magic to this: it's what you do in any well-formed
Delphi application, since, by nature, Delphi code creates dependencies
between objects.
ib_transaction property properly at design time, and things will happen safely.
just containers. Objects in Delphi are not created in random order - they
are created in accordance with your design. A connection needs a session,
a transaction needs a connection, dataset objects need a transaction and a
connection, datasources need a dataset and data-aware controls need a
datasource. When you use <default> properties, the required objects will
be created if they are missing. When you drop in explicit objects, notably
session and transaction objects, and use those in place of the default
objects (a good practice) you must take care to reshuffle the creation
order. You do that by right-clicking on any data object.
Creation order also matters very much at the application level, regardless
of whether you use default session and transaction objects. If you are
using a datamodule, you'll need to go into the DPR and move it ahead in the
creation order, before any forms containing objects that refer to objects
in the datamodule.
objects and their dependencies.
avoided) with very little effort. Hacks lead to more bugs and more hacks....
bug would not throw an "unknown token" error. Are you sure you are using
the correct client library? Did you run instclient.exe after you installed
Fb 1.5?
It could be that you have a very old version of IBO. There have been many
updates since IBO 4.2 (July 2001). What exactly does the Version property
on your Object Inspector tell you? Do you know that to use Fb 1.5 with IBO
lower than 4.3A you have to set OldParameterOrdering on in firebird.conf?
Helen
>Dear All,When you assign explicit transactions, you must look after create order
>
>Environment : Firebird 1.5, Delphi 6, IBO 4.2 (TDataset components)
>
>It's a very normal situation to have more than one dataset connected to
>a TIBOTransaction. Recently i came across a situation (a bug...:) where
>a TIBOQuery.Open() is called before the form had a chance to call
>TIBOTransaction.StartTransaction(), thus screwing up the transaction
>handling logic in my application.
properly. There's no magic to this: it's what you do in any well-formed
Delphi application, since, by nature, Delphi code creates dependencies
between objects.
>To prevent this in the future, i'm thinking about opening ALL TIBOQueryNot a wise solution. Just take care of creation order, assign the
>connected to a particular TIBOTransactions at the same time (which after
>i manually call StartTransaction()).
ib_transaction property properly at design time, and things will happen safely.
>The question is : how can i do this with IBO ?Again - creation order is the important thing. Forms and datamodules are
>Please keep in mind that the TIBOQuery do not necessarily reside in the
>same form/data module as the TIBOTransaction.
just containers. Objects in Delphi are not created in random order - they
are created in accordance with your design. A connection needs a session,
a transaction needs a connection, dataset objects need a transaction and a
connection, datasources need a dataset and data-aware controls need a
datasource. When you use <default> properties, the required objects will
be created if they are missing. When you drop in explicit objects, notably
session and transaction objects, and use those in place of the default
objects (a good practice) you must take care to reshuffle the creation
order. You do that by right-clicking on any data object.
Creation order also matters very much at the application level, regardless
of whether you use default session and transaction objects. If you are
using a datamodule, you'll need to go into the DPR and move it ahead in the
creation order, before any forms containing objects that refer to objects
in the datamodule.
>The property that looks promising was TIBOTransaction.Datasets[] andYou get AVs when you are not careful with creation and destruction of
>TIBOTransaction.DatasetCount, but the code below produced an access
>violation error in fbclient.dll. (Actually I didn't really expect it to
>work, since the elements of the property were TIB_Datasets instead of
>the TIBOxxxx components :D ).
objects and their dependencies.
>...Don't look for hacks to solve a problem that can be fixed *properly* (i.e.
>assert(trans.inTransaction = false);
>trans.startTransaction();
>for i:=0 to trans.datasetcount-1 do begin
> trans.datasets[i].open;
>end;
>...
avoided) with very little effort. Hacks lead to more bugs and more hacks....
>PS: I also came across what I think is a bug in TIBOQuery regardingThere was a parser bug with SELECT FIRST that was fixed long ago. But that
>'select first n' queries. A simple statement like 'select first 5 from
>table' will cause a 'token unknown error, line 3 char 6'. Is this a
>known problem, or it's just me ? How do i report this to jwharton?
bug would not throw an "unknown token" error. Are you sure you are using
the correct client library? Did you run instclient.exe after you installed
Fb 1.5?
It could be that you have a very old version of IBO. There have been many
updates since IBO 4.2 (July 2001). What exactly does the Version property
on your Object Inspector tell you? Do you know that to use Fb 1.5 with IBO
lower than 4.3A you have to set OldParameterOrdering on in firebird.conf?
Helen