Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding candidate key conflicts in a VFP DBC
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Avoiding candidate key conflicts in a VFP DBC
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00978227
Message ID:
00978227
Vues:
72
Hi, all.

This is something that can't happen in SQL Server, but I found in a customer of mine still using DBCs.

They have a table with a string candidate key (beside an AutoInc, surrogate PK). The candidate is the number they give to a given type of document.

Now, when they delete one of these documents, everything is ok; but when they try to add another document with the same number, they got a 'duplicate key' violation, because the deleted record is still there.

I thought about replacing the number with something like sys(2015) before deleting it to avoid collisions, but then I didn't want to put any of this in their user/business logic, but as deep in the DB as possible. The problem is that I can't do it in a DB trigger (I can't update the record within the trigger), and doing two operations at the database logic would mean having to do a bunch of workarounds around the CursorAdapter (which receives a DiffGram from the business tier and access the DB via ADO).

I guess this should be something quite common for people using DBCs (not me, obviously). Any idea?

Thanks in advance,
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform