Subject Re: [IBO] TIBOQuery with TDataSetProvider
Author Helen Borrie
Walter,

At 05:23 PM 25/06/2004 -0400, you wrote:
>Dear Friends,
>
>With D7 Ent I am using a TDataSetProvider to link TIBOQuery to
>TClientDataset, over a SOAP connection. Here is the .dfm code for the
>remote data module:
>
> object DataSetProvider1: TDataSetProvider
> DataSet = IBOQuery1
> Options = [poAllowCommandText]
> Left = 368
> Top = 352
> end
>...
> object IBOQuery1: TIBOQuery
> Params = <>
> IB_Connection = IBODatabase1
> IB_Transaction = IBOTransaction1
> RecordCountAccurate = True
> SQL.Strings = (
> '')
> FieldOptions = []
> Left = 280
> Top = 304
> end
> object IBOTransaction1: TIBOTransaction
> IB_Connection = IBODatabase1
> AutoCommit = True
> Isolation = tiCommitted
> Left = 192
> Top = 304
> end
>
>and in the client datamodule:
>
> object ClientDataSet1: TClientDataSet
> Aggregates = <>
> Params = <>
> ProviderName = 'DataSetProvider1'
> RemoteServer = SoapConnection1
> Left = 112
> Top = 308
> end
>
>Now in code I do:
> with fDataMod.ClientDataSet1 do begin
> Active := False;
> fDataMod.ClientDataSet1.CommandText := Trim(mmoSQL.Lines.Text);
> Active := True;
> end;
>
>The first time I execute this, everything works as expected.
>
>Then I change the SQL string and execute this code again, and on the
>statement Active := False; I get ERemotableException with message 'Blank
>SQL Statement not allowed'.
>
>The third time, the Active := False statement doesn't cause any problem
>(the dataset is already inactive) but on the Active := True statement, the
>old result set appears in the ClientDataSet - the query is not updated to
>the new SQL.
>
>This all worked in an earlier version using TIBQuery and TIBTransaction in
>place of the IBO components.
>
>Am I doing something wrong, or failing to do something right, or is this
>kind of thing beyond the capabilities of the IBO TDataset descendents?

I don't know the score with the setup you have here - trying to set the SQL
from the remote data module - but I've done a small working demo of a
TIBOQuery-TDatasetProvider-TClientDataset setup using a straightforward
setup with ResolveToDataset set True in the provider. Replace my Path
alias with your own before you compile it. Note, "Local" in this demo
means "local to the server", while "Remote" is the remote data module.

About the only thing that seems to be a problem when using the remote
dataset is its lack of capability to be "aware" of native IBO tricks like
GeneratorLinks, that the TIBODataset inherits from TIB_Dataset. This makes
inserting somewhat of PITA when one is used to IBO. Hence, I had to do a
rude hack using a second CDS to fetch a new PK value from the generator
(though I guess it's what VCL users are used to doing).

I'm sure there will be a way to handle sending custom SQL from a
clientdataset. Someone might have done it...

Helen