Article View: borland.public.cppbuilder.database.multi-tier
Article #1662Using TThread to open a query in a RDM: general SQL error
From: Steve Pietrykoski
Date: Mon, 19 Jul 1999 00:00
Date: Mon, 19 Jul 1999 00:00
49 lines
1957 bytes
1957 bytes
Hello all,
In BCB4 Unleashed, a technique of opening a query in a thread is
demonstrated in a two-tier app. I am trying to apply this technique in
a three-tier app, with limited success. I have a RDM with a TDatabase
and a TSession set to AutoSessionName. When I open a query from this
RDM in a thread I receive the following error: "General SQL error:
Connection does not exist." Funny thing, the client still shows the
query properly after the error. What is this error trying to tell me?
Following is the code for the thread object I am using. I have tried
not disconnecting and reconnecting the provider, to no avail.
__fastcall TQueryThread::TQueryThread( TProvider* Provider ) : TThread(
true )
{
FProvider = Provider;
FreeOnTerminate = true;
Resume();
}
void __fastcall TQueryThread::Execute()
{
try {
FQuery = (TQuery *)FProvider->DataSet;
Synchronize( DisconnectProvider );
FQuery->Open(); // <--- error right here
Synchronize( ConnectProvider );
}
catch (Exception* E) {
FQueryException = E;
Synchronize( ShowQryError );
}
}
void __fastcall TQueryThread::DisconnectProvider()
{
FProvider->DataSet = NULL;
}
void __fastcall TQueryThread::ConnectProvider()
{
FProvider->DataSet = FQuery;
}
void __fastcall TQueryThread::ShowQryError()
{
Application->ShowException( FQueryException );
}
Technical Details
Message-ID:
<379397E3.A2F64978@artisansoftware.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,64548564d9f6a046,start X-Google-Attributes: gidfcd2b,public From: Steve Pietrykoski <steve@artisansoftware.com> Subject: Using TThread to open a query in a RDM: general SQL error Date: 1999/07/19 Message-ID: <379397E3.A2F64978@artisansoftware.com> X-Deja-AN: 502871712 Content-Transfer-Encoding: 7bit Organization: Artisan Software, LLC X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.multi-tier