Wiki Home

ga Error

Namespace: VB
When a RI trigger fails, the RI Code generated by VFP stores relevant values in a global array: gaErrors.

gaErrors[nErrorRow,1]=tnErrNo 1. Error number
gaErrors[nErrorRow,2]=tcMessage 2. Error text
gaErrors[nErrorRow,3]=tcCode 3. Program source code that caused the error
gaErrors[nErrorRow,4]=program(1...n) 4. Call stack

gaErrors[nErrorRow,5]=pcParentDBF 5. Parent table name
gaErrors[nErrorRow,6]=pnParentRec 6. Parent record number
gaErrors[nErrorRow,7]=pcParentID 7. Original value of Primary Key of the Parent
gaErrors[nErrorRow,8]=pcParentExpr 8. Parent Primary Key (expression)

gaErrors[nErrorRow,9]=pcChildDBF 9. Child Table Name
gaErrors[nErrorRow,10]=pnChildRec 10. Child Record Number
gaErrors[nErrorRow,11]=pcChildID 11. Original value of Foreign Key in the Child
gaErrors[nErrorRow,12]=pcChildExpr 12. Child Foreign Key (expression)

If you are going to write your own RI triggers, I suggest that you stick to this structure for backward compatibility with legacy error handlers that may expect it.
It is lacking the following:
  • When restricting an update, the Original Key and the New key should be returned.
  • The primary key of the child that caused a restrict rule to fail.
    My version of New RI does this. -- CFK
    Category Error
    Contributors: Carl Karsten
  • ( Topic last updated: 2001.07.11 11:57:51 AM )