Subject | Re: TIB_Session management |
---|---|
Author | kgdonn |
Post date | 2005-10-26T21:36:57Z |
I'm going to make an addendum to my own post based on what I've
learned. I think my port will be simplified to use TIBODatabase
instead of TIB_Connection and TIB_Transaction. I think I'll be OK
if I just make sure that I have a TIBODatabase unique to each thread
and that I take care that all my TIBOTables and TIBOQueries within a
thread have their IB_Connection property set to the thread's
TIBODatabase.
Now the docs for TIB_Session.DefaultSession say, "By default, each
new thread will automatically generate its own component session.
So, if you are doing multi-threaded database access just make sure
that each new thread has its own connection, transaction, etc. and
that it does not access any resource of other threads." Based upon
this it seems I can completely ignore the IB_Session property of
both TIBODatabase and TIBODataset. When a TIB_Session is required,
the components will call TIB_Session.DefaultSession which will
automatically be unique to the current thread and be used by all IBO
components within that thread if I just never specify it explicitly,
correct?
Now, if the above is all true, does it remain all true even if I'm
doing everything in code and my components have Owner=nil? Also
does DefaultSession work correctly even if there is no TThread
object for the current thread, for example, if the thread was
created by a web server calling into my ISAPI module?
Thanks,
Kevin Donn
learned. I think my port will be simplified to use TIBODatabase
instead of TIB_Connection and TIB_Transaction. I think I'll be OK
if I just make sure that I have a TIBODatabase unique to each thread
and that I take care that all my TIBOTables and TIBOQueries within a
thread have their IB_Connection property set to the thread's
TIBODatabase.
Now the docs for TIB_Session.DefaultSession say, "By default, each
new thread will automatically generate its own component session.
So, if you are doing multi-threaded database access just make sure
that each new thread has its own connection, transaction, etc. and
that it does not access any resource of other threads." Based upon
this it seems I can completely ignore the IB_Session property of
both TIBODatabase and TIBODataset. When a TIB_Session is required,
the components will call TIB_Session.DefaultSession which will
automatically be unique to the current thread and be used by all IBO
components within that thread if I just never specify it explicitly,
correct?
Now, if the above is all true, does it remain all true even if I'm
doing everything in code and my components have Owner=nil? Also
does DefaultSession work correctly even if there is no TThread
object for the current thread, for example, if the thread was
created by a web server calling into my ISAPI module?
Thanks,
Kevin Donn