[Pas2js] Post in TSQLDBRestDataset

Michael Van Canneyt michael at freepascal.org
Tue Apr 13 12:46:39 CEST 2021


You can send it to me in private, yes...

Michael.

On Tue, 13 Apr 2021, Gabriele Cappelletto via Pas2js wrote:

> Do you want me to attach the whole project to try?
>
>
>
> Il 13/04/21 12:14, Gabriele Cappelletto via Pas2js ha scritto:
>> #0 fpc_raiseexception at :0
>> #1 FPJSON$_$TJSONDATA_$__$$_DOERROR$ANSISTRING$array_of_const at :0
>> #2 
>> FPJSON$_$TJSONOBJECT_$__$$_DOADD$UTF8STRING$TJSONDATA$BOOLEAN$$LONGINT 
>> at :0
>> #3 .Ld6$strlab at :0
>> #4 ?? at :0
>> #5 ?? at :0
>> #6 .Ld6$strlab at :0
>> #7 ?? at :0
>> #8 ?? at :0
>> #9 ?? at :0
>>
>> I don't know or am I doing something wrong, the instructions to modify 
>> are:
>>
>>   FData.FieldByName('iso').ProviderFlags:=[pfInkey,pfInUpdate];
>>   FData.First;
>>   FData.Edit;
>>   FData.FieldByName('NAME').AsString:='romp';
>>   FData.Post;
>>   FData.ApplyUpdates;
>>
>>
>> Il 13/04/21 12:06, Michael Van Canneyt ha scritto:
>>>
>>> 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
>>>>
>>>>
>>>>
>> _______________________________________________
>> Pas2js maillist  -  Pas2js at lists.freepascal.org
>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>


More information about the Pas2js mailing list