#1
|
|||
|
|||
Thread Question
Hi
Is this allowed: Pop up a new form that asks for user input (start and end date), when user presses 'Go' start a new thread that's only work is to do 'nxQuery1->Open();' which allows me to display an animated progress bar while the query executes (I expect it to take a while depending on the date range selected by the user). The nxQuery will be placed on the form and nothing in my code ever touches it (other than the thread) and it is not connected to any controls (other than the Database->Session->Server->Transport chain). In the past I have created a new session and then database and then query but it occurs that this is overkill in this scenario. I have created a test app and tested a good few times and it definately appears to work but I really don't want to start receiving errors in my real application. Best regards Chris F |
#2
|
|||
|
|||
Re: Thread Question
If you make 100% sure that nothing else is touching that session at the same
time this will work. I personally would always use a dedicated chain for every thread. I've a small helper unit that implements a very simple TSimpleDBThread which has the following: public constructor Create(aTransport: TnxBaseTransport; anAlias: String; aSuspended: Boolean); virtual; destructor Destroy; override; function GetTable: TnxTable; function GetQuery: TnxQuery; property Session: TnxSession read fSession; property Database: TnxDatabase read fDatabase; end; Alternatively if you use a session pool just check out the TnxThreadWithSession, TnxThreadWithDatabase classes in nxdb. -- Hannes Danzl [NexusDB Developer] Newsgroup archive at http://www.tamaracka.com/search.htm |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thread question... | Jon P. Grewer | nexusdb.public.discussions | 2 | 24th July 2007 07:09 AM |
Executing Query in an Thread | Andreas Osswald | nexusdb.public.support | 1 | 24th August 2006 01:07 AM |
Thorsten, Thread example ... | Scott Martin | nexusdb.public.discussions | 4 | 30th June 2006 10:22 PM |
NexusDB Thread Example | William E. Mahaffey | nexusdb.public.discussions | 8 | 18th September 2003 01:54 PM |
drive too small - new thread | Theo | nexusdb.public.support | 7 | 17th July 2003 06:57 AM |