MultiThreading and Databases : Any guidelines ?

Quote
dtho...@subliminal.com (Lurker) writes:
> Marc-Etienne HUNEAU <mehun...@ifhamy.insa-lyon.fr> wrote:

> >       Are there any MAIN rules (and tricks !) in using databases in a
> >multithread app ?

> >       (Sharing the base, the tables....)

> Rule #1:  Every thread that needs to do database things must associate
> itself with a database session.
> Sessions.OpenSession(IntToStr(GetCurrentThreadID)) is a good start.

> Rule #2:  All datasets that a thread uses must be attached to the
> thread's database session.  Set the SessionName of all the thread's
> dataset components to the name of the thread's associated session
> (IntToStr(GetCurrentThreadID), eg)

> Rule #3:  Datasets can't cross thread boundaries.  You can't use the
> results of a query that was executed in another thread.  However, I
> think you can clone the query cursor handle to gain access to the
> query results in your thread.  Check the BDE API docs.

> -Danny

tricks, MarKet ? t'as la trique ? faut que t'arrtes le Delhi,
c'est pas bon pour toi, t'cris que des conneries, et en public
en plus !