Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger query
Message
De
17/10/2013 08:05:27
 
 
À
17/10/2013 06:41:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01585722
Message ID:
01585724
Vues:
48
>>I have a customer table which has 3 associated child tables; customer.custid is the primary key in customer. Custid is the the foreign key in the child tables. I have "Update" and "Delete" rules established in the RI builder.
>>
>>When I have the customer table open and I do a block replace such as REPLACE ALL CUSTOMER.MAILOUT WITH .F. the update trigger runs for every record - which takes a long time. I assumed the trigger would only run if the key field was being changed.
>>
>>Is there some way I can prevent the trigger from running as this particular update has no requirement to check the RI of child tables? Or maybe I have a fundamental misunderstanding of how this works.
>>
>>Barry Sutton
>
>Barry,
>
>The trigger has to run. It will exit when it finds that the key field has not changed

Gregory,
OK, but despite this, it is taking in excess of 3 minutes to do the REPLACE ALL in 12,000 records over a network as the RI checks each of the child table key fields - running all the associated RI code to achieve this.
I have now introduced a stored procedure which checks the value of a global flag glDisableRIUpdates (.t. or .f.) and if set to .f. it allows the _ri_update routine to run; if set to .t. it returns without running the _ri_update code. This has speeded up the operation to a few seconds.
The only downside I can identify is that if I change the RI code via the inbuilt RI builder wizard, the _ri_update procedure name is reintroduced into the database container against the customer table and I have to amend this to point to my own (intermediate) stored procedure.
It seems odd to me that the _ri_update is called on fields other than the key fields as the latter are the only ones that would seem to be critical to the RI aspect.

Barry.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform