Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use of Stored Procedures
Message
 
À
22/05/1998 15:28:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00101049
Message ID:
00101896
Vues:
23
The process I described below is exactly how I am creating audit logs for my tables now. As far as returning the error code, one thing you could do is make use of the "gaerror" public array created by when the code generated by the RI builder runs and then check that array for error codes and messages (see Knowledge Base article Q142284).

>>>Dave,
>>>
>>>I don't think so. If I understand correctly, Rob is talking about adding an audit trail, or tickler, or something. I don't think this is a matter of ensuring a parent record exists when a child is added. Maybe Rob could clarify for us.
>
>>Rob,
>>From my experience, it would seem that you would build these rules as Stored Procedures that would be called as part of you INSERT/UPDATE/DELETE triggers.
>>
>>In your example, you would write a function to create a record in table Y in your stored procedures ("AddtoY"). Then in the properties of table X, set your INSERT trigger to run the new stored procedure. Just be careful how you handle the call if there is already a function in yout INSERT trigger created by the referential integrity builder:
>>
>>INSERT TRIGGER: _ri_insert_x() AND AddtoY()
>>
>>Hope this helps you out.
>
>Dave & Josh:
>
>Thanks for the input - I am indeed trying to build an audit type of function where inserts into various tables are all logged in a journal type of table. While I think the 3 tier architecture really would do what I want, it is probably overkill for what I am trying to do.
>
>Anyway, I am looking at Stored Procedures and defining insert triggers. Is there any way to handle returning a code (i.e. 0=OK, 1=INVALID_DATA, etc) from AddToY() rather then .T. if added and .F. if not ? This may seem weird, but because I am doing lookups and inserts in the AddToY() function, I want to determine if the function failed because the lookup failed or if the insert failed. I know I can define the INSERT TRIGGER as __ri_insert_x() AND AddToY() = ADD_REC_OK, and the trigger will return .T. if AddToY() returned a certain value. The question is how do I return the result of AddToY() to the object that called the INSERT in the first place ?
>
>Sorry if this ambigous ...
>Thanks again
>Rob
I would give my left arm to be ambidextrous!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform