Subject Re: Re: Re: [IBO] ICS ERROR 335544726
Author Helen Borrie
At 08:03 PM 15/07/2003 +0530, you wrote:


>I was writing single threaded applications till now so I generally ignored
>IB_Session so the default was being used.
>Am just venturing into multithreaded database connections.
>
>Just to make sure that I have not missed anything
>
>If each thread is instantiating a datamodule.
>
>Every datamodule should have
>
>One Session object (Created First)
>One Connection object (This is set as the default connection for the
>session object)
>One or more transaction objects (using this connection object).
>Recordsets using the appropriate transaction objects.
>
>Is that right

Yes. Actually, you can have multiple connection objects inside your
"mountaineer kit" (to different databases, obviously!); and you would have
one of your transaction objects spanning all of the connections that you
wanted to operate on for a single task.

Try to create a single datamodule with as many of the "common" components
as there are; and conditionally create any additional transactions and
non-common datasets as you need for each particular type of thread that
might instantiated. The session object that is created when you
instantiate the datamodule will take care of isolating all of the objects
that belong to it.

This is a lot nicer from an OO point of view. It's usually simple to deal
with the individual differences, in a generic CreateMyDatasets method, with
its polymorphic elements spinning off from a CASE statement according to
the arguments it receives. If you have to add some new kinds of threads
later, it's maybe half a dozen lines of code then to implement it.

Helen