🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #713

Re: how to transfer the SQL command from client to Application Server?

#713
From: John Graham
Date: Sun, 25 Feb 2001 15:48
64 lines
3453 bytes
That'll work, but you can also instantiate an instance of the app. server dispatch
interface in your client.  You can then create app. server methods to have the app.
server perform any tasks you want, including modifying the SQL properties of your
TQuery objects.  You call these methods from your client through the dispatch
interface passing any required parameters.

The dispatch interface is instantiated as follows:

 SMSrvrDisp = new ISysManSrvrDisp();

If you're using a Socket connection bind it like this:
  SMSrvrDisp->Bind(WideString(SysManSocket->ServerName));

If you're using a DCOM Connection, bind it like this:
  SMSrvrDisp->Bind(DCOMConnection->GetServer());

Use the IsBound() method of the dispatch interface to make sure binding worked.

For example, SQL statements can be passed to an app. server method as a WideString
type using the WideString's Copy() method like this:

WideString  wsXfrHistSQL;

 // add the XfrHistQry SQL statement to the WideString
wsXfrHistSQL = "SELECT XFR.Time, XFR.Server, XFR.ClientCode, XFR.Action, "
"XFR.FileName, XFR.FileSize, XFR.FileDate "
"FROM XfrHistory AS XFR (NOLOCK) "
"WHERE  XFR.ClientCode = :ActCode "
"ORDER BY XFR.Time";

 // transmit the SQL statement up the pipe
SMSrvrDisp->SetXfrHistQrySql(wsXfrHistSQL.Copy());

App. server methods are easy to set up using the Type Library.  For the above
example, the parameter type for app. server method "SetXfrHistQrySql()" is BSTR.

The dispatch interface is descended from the TAutoDriver class.  Also see the AdHoc
example in your BCB Examples\Midas Folder.

Regards,
John

"mykle hoban (borland)" wrote:

> The component is called TDatasetProvider. You can use the CommandText property
> of your ClientDataset to dynamically set the SQL property. Note: you'll have to
> set the poAllowCommandText = true in the DatasetProvider options.
>
> Hope this helps,
>
> _mykle
>
> Will Hunt wrote:
>
> > I want to let the client to dynamically generate the SQL command. I know in
> > the c/s
> > environment ,it's not difficult to realize it.But,now i adapted the midas
> > mode ,and the system has been used for some time. I want to how to resolve
> > it .I've seen some books,takling about BCB3.0 or4.0 , have introduce to
> > resolve it through TProvider,but in BCB5 this component has seems to
> > disappeared.
> > Can anyone help me! THX
> >
> >                                 Willy
Technical Details
Message-ID: <3A992959.E738B9A5@salts.navy.mil>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!163.12.6.113
References: <3a920567_1@dnews> <3A941BA8.2CF25C52@borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,3f9b465f8584d5ee
X-Google-Attributes: gidfcd2b,public
X-Google-ArrivalTime: 2001-02-25 08:00:04 PST
Message-ID: <3A992959.E738B9A5@salts.navy.mil>
Date: Sun, 25 Feb 2001 10:48:41 -0500
From: John Graham <jgraham@salts.navy.mil>
Organization: SALTS Central
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.multi-tier
Subject: Re: how  to transfer the SQL command from client to Application Server?
References: <3a920567_1@dnews> <3A941BA8.2CF25C52@borland.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 163.12.6.113
X-Trace: 25 Feb 2001 07:45:54 -0800, 163.12.6.113
Lines: 65
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!163.12.6.113