[Pas2js] Post in TSQLDBRestDataset

Gabriele Cappelletto cappelletto at inwind.it
Mon Apr 12 18:46:20 CEST 2021


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;


but it doesn't work anyway. How should I manually declare the primary key?

Thank you



Il 12/04/21 18:26, Michael Van Canneyt ha scritto:
>
>
> On Mon, 12 Apr 2021, Gabriele Cappelletto via Pas2js wrote:
>
>> I can't solve the problem. How do I declare the primary key to solve 
>> the problem below. I tried like this but I don't solve
>>
>>
>> .Fields.FindByFieldName('ISO').Options := [foInKey];
>>
>>
>> How should I do?
>
> Where do you do this ?
>
> You must do this in the server, after the ExposeDatabase statement.
>
> If you have defined primary keys on the server database fields, they 
> should
> be picked up by the server. If you didn't then you must define them
> manually for every table...
>
> Michael.
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list