Frank Burleigh Guest
|
Posted: Tue May 11, 2004 11:41 pm Post subject: Wrestling with BeforeUpdateRecord |
|
|
Greetings group. I've spent the better part of the day learning the
trick that makes client data set (midas) update a (sybase) table when
the sql that populated the client data set is like:
select care.*,nocare.Description
from realdatatable care, humantexttable nocare
where care.SomeKey*=nocare.Description
What I learned is that Delta in the CDS is like a dataset on its own,
and that you have to hide fields within it from BeforeUpdateRecord on
the client data set.
void __fastcall Something::BeforeUpdateRecord(
TObject *Sender, TDataSet *SourceDS, TCustomClientDataSet *DeltaDS,
TUpdateKind UpdateKind, bool &Applied)
{
TField* f=DeltaDS->FieldByName("Description");
f->ProviderFlags.Clear();
}
I also learned that, with this sql, this callback wasn't necesary:
void __fastcall Something::BDEClientDataSet1GetTableName(TObject
*Sender, TDataSet *DataSet, AnsiString &TableName)
{
TableName="realdatatable";
}
Now some questions:
1. could this be done more efficiently?
2. upWhewreAll seems ineffecient but upWhereKeyOnly can't be
satisfactory (I'd guess) because the client data set doesn't really know
the indexes for the underlying table. Is there a means to tell it?
3. Has the client data set / midas architecture squirled away somewhere
any record of the table source for each field? If so, that would
obviate any need for me to keep separate records about which fields need
the ProviderFlags.Clear() treatment.
If it matters, all my client data sets are made with new not d'n'd; db
server is either Sybase or Oracle.
--
Frank Burleigh
Indiana University School of Law
[email]burleigh (AT) indiana (DOT) edu[/email]
|
|