Subject Re: [IBO] Parameter problems using DataSnap and IBO
Author kokok_kokok
I am sorry, the version is 4.2.Ie

I will try to send you a sample, the problem it is a little part of a
big project and I need to isolate it.

In fact, I think that it is:

1) Table with "id" (primary key), "description" fields

2) Form with a TIBOQuery, TProvider, TClientDataSet and a edit control

3) Insert 1 row

4) Now, if you modify the "id" field using the edit control and then
call ClientDataset.ApplyUpdates, the problem will be appear


As I said, ApplyUpdates call to PSUpdateRecord IBO function, this
function eliminated the OLD. prefix of the parameter name. Then, the
AssignParamsValues IBO function cannot find the corresponding
parameter, because now there are 2 parameters with the same name
(ID), and before calling PSUpdateRecord fuction, they were differents
(ID and OLD.ID)

Thanks for your help


--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...>
wrote:
> Thanks for pointing this out.
> Did I miss it or what version of IBO are you at?
>
> Will you send me a sample app in private too please?
>
> Thanks,
> Jason Wharton
> www.ibobjects.com
>
> ----- Original Message -----
> From: "kokok_kokok" <kokok_kokok@y...>
> To: <IBObjects@yahoogroups.com>
> Sent: Thursday, January 15, 2004 3:05 PM
> Subject: [IBO] Parameter problems using DataSnap and IBO
>
>
> >
> > I use DataSnap with IBO. When I modify the id of a row, IBO does
not
> > generate the appropriate parameters for the SQL sentence.
> >
> > PRIMARY KEY of the table = EMPRESA, TIPUS, CODI
> >
> > IBO generates the following sentence when I modify the CODI field:
> >
> >
> > UPDATE CODIFICATION SET EMPRESA = :EMPRESA , TIPUS
= :TIPUS ,
> > CODI = :CODI , DESCRIPCIO = :DESCRIPCIO
> > WHERE CODIFICATION.EMPRESA = :OLD.EMPRESA AND
CODIFICATION .TIPUS
> > = :OLD.TIPUS AND CODIFICATION.CODI = :OLD.COD
> >
> > This sentence is fine. The problem is in parameters. If I modify
> > CODI, for example setting CODI=1, if before CODI was 0, I can
see in
> > the SQL monitor:
> >
> > [PARAMETERS]
> > CODI=0
> > OLD.CODI=0
> >
> > It is an error, because CODI should be 1, not 0.
> >
> >
> > I have been tracing the IBODataset.pas source and I have found
the
> > reason but not the solution.
> >
> >
> > 1) PSUpdateRecord deletes the "OLD." prefix of the "OLD.CODI"
> > parameter name
> >
> >
> > 2) Then , line 6593, function TIBODataSet.AssignParamsValues
> >
> >
> > if Assigned( Self.DataSource ) and Assigned(
> > Self.DataSource.Dataset ) then
> > if Assigned( Self.DataSource.Dataset.FindField(
> > tmpCol.FullFieldName )) then
> > Continue;
> > AssignParamValueToCol( AParams[ii], tmpCol );
> > tmpParam := FindParam( tmpCol.FullFieldName );
> > if Assigned( tmpParam ) then
> > tmpParam.Value := AParams[ii].Value;
> > end;
> > end;
> > end;
> > finally
> >
> >
> >
> > The line "tmpParam := FindParam( tmpCol.FullFieldName );" cannot
> > find the corresponding parameter. It fails and it assigns the new
> > value to OLD.CODI because tmpCol.FullFieldName = "CODI",
> > not "OLD.CODI" (remember the previous PSUpdateRecord function)
> >
> > Well, it is my diagnostic but I do not know the solution. Any
help
> > well be welcome. Thanks