NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys on February 28, 2019, 04:08:05 AM
-
Hi,
I have several db-methods that each gives an error when inserting a new record:
Cannot save a duplicate record. Record is duplicating another on the following fields:OBJ__GUID = 91ZJQHTR4IJ8AZ7L
The error is generated in the p_web.CheckForDuplicates method, but there are no existing records in those tables. On all of the tables, the database (PostgreSQL) generates the primary key column value, so Clarion does not touch the column (using READONLY on the external column name in the DCT). I have NT 10.35 on Clarion 11.
Any ideas?
Thys
-
Hi,
I've looked at the code surrounding the .CheckForDuplicates call in the InsertRecord: routine. Before this call, it also calls PrimeFields - where there is this funny code:
PrimeFields:Object routine
data
code
case lower(TableAction)
of 'insert'
orof 'add'
If OBJ:guid = '' then OBJ:guid = packet.MakeGuid() .
of 'update'
orof 'change'
End
It actually tests whether the guid column (the primary key column) is blank - if not it auto populates it. BUT in the DCT I've marked this column as READONLY. So it should not be primed here.
Also, if this column was not called "guid", would this behaviour be the same? I've called it this out of habit. Should it be something else?
Thanks
Thys
-
I'd be interested in the dict so I can allow for this setup, but yeah it's matching on the name, so if you changed the name it would fix it for you.
cheers
Bruce
-
Thanks Bruce. I've emailed it to you.
-
Bruce,
Even after adding an EXIT statement at the start of the PrimeFields: routine, the CheckForDuplicates routine still reports that it's trying to add a duplicate record - but now with an empty guid value:
"Cannot save a duplicate record. Record is duplicating another on the following fields:OBJ__GUID ="
Thys
-
>> BUT in the DCT I've marked this column as READONLY. So it should not be primed here.
fixed in 11.08
>> the CheckForDuplicates [method] still reports that it's trying to add a duplicate record
fixed in 11.08
cheers
Bruce
-
Hi Bruce.
How did you fix the problem? I would like to do the same in the code - and get the "formal" fix when 11.08 is available.
Thanks
Thys
-
That might be tricky now Thys - not sure what all has changed in the template file until I do a merge.
I'll try and expedite the 11.08 release next week.
cheers
Bruce
-
Thanks. Until then I've changed the CLW file not to run the code in CheckForDuplicates. It works out that if there was a duplicate then SQL returns the correct error description.