🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #946

Client Data Set or Not Cllient Data Set?

#946
From: Franz J Fortuny
Date: Fri, 22 Sep 2000 00:00
76 lines
2696 bytes
Consider this code from a client/server application (two-tier)
that is trying to use Client Data Sets (to make the aggregates
work, mainly�):

o->cRecibos->Edit();
  o->cRecibosidrecedo->AsInteger=1;
  o->cRecibospago->AsFloat=o->cPagostocanti->Value.dblVal;
 try
 {
  o->dbCob->StartTransaction();
  o->cRecibos->ApplyUpdates(0);
  o->cFacturas->ApplyUpdates(0);
  o->cPagos->ApplyUpdates(0);
  o->cFacturas->First();
  while(!o->cFacturas->Eof)
  { if(o->cFacturasseabona->AsFloat != 0.00)
    {o->qIdopag->Close();

o->qIdopag->Params->Items[0]->AsInteger=o->cRecibosidrecibo->AsI
nteger;

o->qIdopag->Params->Items[1]->AsInteger=o->cFacturasidfactura->A
sInteger;

o->qIdopag->Params->Items[2]->AsFloat=o->cFacturasseabona->AsFlo
at;
    o->qIdopag->ExecSQL(); } o->cFacturas->Next(); }
  o->dbCob->Commit();
 }
 catch(...)
 {
  o->dbCob->Rollback();
 }

Here is what the first 3 ApplyUpdate(0) instructions generate at
the SQL Server (PostgreSQL):

o->cRecibos->ApplyUpdates(0);

insert into "recibos"  ("idrecibo", "idbenef", "pago",
"idrecedo")
values  (19, 7, 8383.500000, 1)

o->cPagos->ApplyUpdates(0);

insert into "pagos"  ("idrecibo", "idforpag", "canti", "iddoc")
values  (19, 2, 4500.000000, NULL)

insert into "pagos"  ("idrecibo", "idforpag", "canti", "iddoc")
values  (19, 1, 3883.500000, NULL)

However,

o->cFacturas->ApplyUpdates(0);
does not GENERATE ANY STATEMENT, and it should �create� these
two statements:

update �facturas� set saldo = 0 where idfactura = 2;
update �facturas� set saldo = 0 where idfactura = 2;

the qIdopag query does its job properly.

However, why does the �facturas� Client Data Set fail?

I have reviewed the properties of the persistent fields,
including the �saldo� field, and it is updatable, while the
other fields are not. Also, field �idfactura� was defined as the
key, so that the above update statement could be automatically
formed.

Any light upon why this happens will be greatly appreciated�

If the my application is a two-tier (classic client/server)
should I refrain from using ClientDataSet entirely?

Franz J Fortuny
Technical Details
Message-ID: <39cc212e_2@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: fcd2b,1dbf1098ade4ead2,start
X-Google-Attributes: gidfcd2b,public
From: "Franz J Fortuny" <ffortuny@ivsolnospam.com>
Subject: Client Data Set or Not Cllient Data Set?
Date: 2000/09/22
Message-ID: <39cc212e_2@dnews>
X-Deja-AN: 673103367
X-Trace: 22 Sep 2000 20:19:10 -0800, 148.233.221.92
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.cppbuilder.database.multi-tier
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300