[Pas2js] Post in TSQLDBRestDataset
Michael Van Canneyt
michael at freepascal.org
Tue Apr 13 12:06:31 CEST 2021
Strange...
Can you please provide a server stacktrace ?
Because without that, there is little I can do to analyse the problem.
Michael.
On Tue, 13 Apr 2021, Gabriele Cappelletto via Pas2js wrote:
>
> I made a few attempts, inserting a new record works, but editing and deleting give this result on the server:
>
>
> Exception 'EJSON'
>
> Duplicate object member: "error"
>
>
> Il 12/04/21 21:29, Michael Van Canneyt ha scritto:
>
>
> On Mon, 12 Apr 2021, Gabriele Cappelletto via Pas2js wrote:
>
> The test table is this:
>
> CREATE TABLE COUNTRY
> (
> ISO char(2) NOT NULL,
> NAME varchar(80) NOT NULL,
> NICENAME varchar(80) NOT NULL,
> ISO3 char(3) DEFAULT NULL,
> NUMCODE smallint,
> PHONECODE smallint NOT NULL,
> CONSTRAINT COUNTRY_PKEY PRIMARY KEY (ISO)
> );
>
> The database is firebird 2.5
>
> In the server I wrote:
>
> FDisp.ExposeDatabase(TIBConnectionDef.TypeName,'localhost','/var/tmpGabry/testrest.fdb','SYSDBA','masterkey',Nil,
> [foFilter,foInInsert,foInUpdate,foOrderByDesc]);
>
>
> but it gives me the problem listed below. So then I wrote
>
>
> FDisp.ExposeDatabase(TIBConnectionDef.TypeName,'localhost','/var/tmpGabry/testrest.fdb','SYSDBA','masterkey',Nil,
> [foFilter,foInInsert,foInUpdate,foOrderByDesc]);
>
> With FDisp.Schemas[0].Schema.Resources do
> begin
> FindResourceByName('country').Fields.FindByFieldName('ISO').Options:=[foInKey,foInInsert,
> foInUpdate,foRequired,foFilter,foOrderBy,foOrderByDesc];
> end;
>
>
> That should be enough. The foInKey tells the server to use the field ISO as
> the primary key.
>
> Together with the client-side
> FieldByname('ISO').ProviderFlags:=[pfInkey,pfInUpdate];
>
> It should work. (you obviously need both)
>
> A mechanism to set the client-side field properties based on server-side
> metadadata (all data is available, after all) is still on my todo list...
>
> Michael.
>
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>
>
>
More information about the Pas2js
mailing list