🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
1 messages
1 total messages Started by Franz J Fortuny Fri, 22 Sep 2000 00:00
Client Data Set or Not Cllient Data Set?
#946
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads