key violation when posting record

rbarth

Member
i use oracle, doa, midas and delphi5.

for inserts i set the key fields in before insert triggers in oracle.

when i insert records in my client cds i get a key violation during the 2. post because the 2. key is null, like the first one.

if i use ado instead of doa i don't have this problem so it seem that doa/oracledataset tells the cds via the provider wich fields are key fields.

so how can i prevent cds from knowing that this field is a key field?

regards,
ralf barth
 
Hmm, I don't immediately have a solution for this. The key is indeed reported to the client dataset. I guess we need a feature that would allow you to disable this.

------------------
Marco Kalter
Allround Automations
 
thx marco,

1. question:
do you plan to implement thouse solution and when would it be ready?

the problem is: there is a (very bad i guess) solution by dan miser: i have to fill the key fields with dummy numbers for the post and then mark them as 'no update fields', (TField.ProviderFlags.pfInUpdate := false i guess, have to test if it works).
for this dirty workaround (i really don't like it) i should know which fields are the key fields. we have no special cds/provider/oracledataset for each table we do all the things dynamic. but i can't find a property in my clientdataset field object for this.
so the 2. question:
can i read the info you give the cds about the key fields?

regards,
ralf
 
1.
We still have to look into this, so I can't tell you if and when it will be implemented.

2.
I think (I'm not sure, I haven't tried this), that TClientDataSet.IndexDefs represent the keys.

------------------
Marco Kalter
Allround Automations
 
I have created a solution of my own. It's really simple, just checking for OracleDictionary.EnforceConstraints and OracleDictionary.DisabledConstraints.IndexOf(constraint_name) < 0

in method "TOracleTableInfo.GetConstraints".

No Item will then be created.
 
It's in OracleData.pas, if you have the Direct Oracle Access source files.

------------------
Marco Kalter
Allround Automations
 
Back
Top