<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=ISO-8859-15">
  </head>
  <body>
    <p>I made a few attempts, inserting a new record works, but editing
      and deleting give this result on the server:</p>
    <p><br>
    </p>
    <p>Exception 'EJSON'</p>
    Duplicate object member: "error"
    <p><br>
    </p>
    <div class="moz-cite-prefix">Il 12/04/21 21:29, Michael Van Canneyt
      ha scritto:<br>
    </div>
    <blockquote type="cite"
      cite="mid:alpine.DEB.2.22.394.2104122116360.26306@home">
      <br>
      <br>
      On Mon, 12 Apr 2021, Gabriele Cappelletto via Pas2js wrote:
      <br>
      <br>
      <blockquote type="cite">The test table is this:
        <br>
        <br>
        CREATE TABLE COUNTRY
        <br>
        (
        <br>
          ISO char(2) NOT NULL,
        <br>
          NAME varchar(80) NOT NULL,
        <br>
          NICENAME varchar(80) NOT NULL,
        <br>
          ISO3 char(3) DEFAULT NULL,
        <br>
          NUMCODE smallint,
        <br>
          PHONECODE smallint NOT NULL,
        <br>
          CONSTRAINT COUNTRY_PKEY PRIMARY KEY (ISO)
        <br>
        );
        <br>
        <br>
        The database is firebird 2.5
        <br>
        <br>
        In the server I wrote:
        <br>
        <br>
FDisp.ExposeDatabase(TIBConnectionDef.TypeName,'localhost','/var/tmpGabry/testrest.fdb','SYSDBA','masterkey',Nil,
        <br>
                   [foFilter,foInInsert,foInUpdate,foOrderByDesc]);
        <br>
        <br>
        <br>
        but it gives me the problem listed below. So then I wrote
        <br>
        <br>
        <br>
FDisp.ExposeDatabase(TIBConnectionDef.TypeName,'localhost','/var/tmpGabry/testrest.fdb','SYSDBA','masterkey',Nil,
        <br>
                   [foFilter,foInInsert,foInUpdate,foOrderByDesc]);
        <br>
        <br>
            With FDisp.Schemas[0].Schema.Resources do
        <br>
              begin
        <br>
FindResourceByName('country').Fields.FindByFieldName('ISO').Options:=[foInKey,foInInsert,
        foInUpdate,foRequired,foFilter,foOrderBy,foOrderByDesc];
        <br>
                end;
        <br>
      </blockquote>
      <br>
      That should be enough. The foInKey tells the server to use the
      field ISO as
      <br>
      the primary key.
      <br>
      <br>
      Together with the client-side
      <br>
      FieldByname('ISO').ProviderFlags:=[pfInkey,pfInUpdate];
      <br>
      <br>
      It should work. (you obviously need both)
      <br>
      <br>
      A mechanism to set the client-side field properties based on
      server-side
      <br>
      metadadata (all data is available, after all) is still on my todo
      list...
      <br>
      <br>
      Michael.<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Pas2js maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Pas2js@lists.freepascal.org">Pas2js@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js">https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js</a>
</pre>
    </blockquote>
  </body>
</html>