/** * Method declaration * * * @param row * * @throws Exception */ public void checkInsert(object[] row) { if (iType == MAIN || iType == UNIQUE) { // inserts in the main table are never a problem // unique constraints are checked by the unique index return; } // must be called synchronized because of oMain for (int i = 0; i < iLen; i++) { object o = row[iColRef[i]]; if (o == null) { // if one column is null then integrity is not checked return; } oMain[iColMain[i]] = o; } // a record must exist in the main table Trace.check(iMain.find(oMain) != null, Trace.INTEGRITY_CONSTRAINT_VIOLATION); }
/** * Method declaration * * * @param row * * @throws Exception */ public void checkDelete(object[] row) { if (iType == FOREIGN_KEY || iType == UNIQUE) { // deleting references are never a problem // unique constraints are checked by the unique index return; } // must be called synchronized because of oRef for (int i = 0; i < iLen; i++) { object o = row[iColMain[i]]; if (o == null) { // if one column is null then integrity is not checked return; } oRef[iColRef[i]] = o; } // there must be no record in the 'slave' table Trace.check(iRef.find(oRef) == null, Trace.INTEGRITY_CONSTRAINT_VIOLATION); }