Make.Index
!File Records
Relational Indexes - Reordering
Referential Integrity
QTIPS - Deleting Master Relationally Indexed Records
Utility Diskette # 4
Referential Integrity
Referential Integrity
RTP Series - RTP42
RTP Series - RTP51
Reader's Clinic - AREV Runtime
@ATTACK - @PDisk.On
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
AREV Comes to Czechoslovakia Les Palenik, Cosmotron Systems
Redefining Keys
Referential Integrity
@ATTACK - @Edit.Keys
@ATTACK - @Environ.Keys
@ATTACK - @Int.Const
@ATTACK - @Move.Keys
@ATTACK - @Priority.Int
@ATTACK - @Macro.Keys
@ATTACK - @Macro.Mode
Playing with Scan Codes
Uncommon Knowledge - WC_Unkeys%
Uncommon Knowledge - WC_Except_Keys%
Uncommon Knowledge - WC_Soft_Keys%
Bugs and PCs - Indexing 01 vs 1
VERBatim - V77
Index Sub Revisited
Indexing on Xlates
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
Simple Security
Batch.Indexing
QTIPS - Batch.Indexing Close Down
What's New (and un(der)documented!) In 2.12
Playing with Scan Codes
QTIPS - Compiling Protection Code
QTIPS - Invalid Code and Command
QTIPS - Code/Command Help
Compiling 64K on a Shoestring by Blaise Wrenn (LexStat Systems Ltd)
QTIPS - Deleting Master Relationally Indexed Records
Version 3 Technical Highlights - Deleting Accounts
Version 3 Technical Highlights - Deleting Rows Programmatically
Version 3 Technical Highlights - Deleting Tables Programmatically
Version 3 TCL Subroutines - Deleting Rows
Version 3 TCL Subroutines - Deleting Accounts
Version 3 TCL Subroutines - Deleting Tables
Version 3 TCL Subroutines - Removing Lists
QTIPS - DOSTime
VERBatim - V11
@ATTACK - @Backgrnd.Time
@ATTACK - @Index.Time
QTIPS - Time-outs in Windows
QTIPS - DOS File Names
DOS Interfacing (Part II)
VERBatim - V116
@ATTACK - @Pri.File
@ATTACK - @Rollout.File
File Variables
How Indexes Are Updated
Index Record Layouts
QTIPS - File Variable of File In SELECT Statement
QTIPS - Amending non-Attached Files
LINEAR HASH FILE STRUCTURES - Part 1
Index Flush
QTIPS - File Handle Structure
VERBatim - V126
Esc.To.Exit
Uncommon Knowledge - WC_WST_CHAR%
Reader's Clinic - Functions and Subroutines
Argument passing - Subroutines and Functions - Mike Pope
Prompt Help
VERBatim - V6
QTIPS - BASIC Options
The End of the Line - Mike Pope and Hal Wyman
QTIPS - FOR/NEXT variables
Vroom
RTP Series - RTP32
Utility Diskette # 3 - Part I
Referential Integrity
Reader's Clinic - Related Windows
VERBatim - V16
Popups
Utility Diskette # 3 - Part I
Reader's Clinic - Page Marks in Windows
Reader's Clinic - Naming Routines
Reader's Clinic - Prompting for Passwords
Reader's Clinic - Removing "Searching Cross References" Message
Message
Trapping Message Calls
A RevTechie Replies - And Miscellaneous Jottings - Mike Pope - Revelation Technologies (UK) Ltd
QTIPS - Standardising Error Message Display
QTIPS - Interrupt Proof Error Messages
QTIPS - Improving the Message Window
Version 3 Technical Highlights - New Message Types
Reader's Clinic - Screen Width
QTIPS - @Date.Format
@ATTACK - @Date.Format
QTIPS - Short Cut Implicit Formatting
Utility Diskette # 4
REVMEDIA Revisted
@ATTACK - @Modal
Reader's Clinic - Page Marks in Windows

RevMedia FKB

DocumentV2I2A3
TitleReferential Integrity
KeywordsREFERENTIAL
INTEGRITY
RELATED
KEYS
RELATIONAL
TextOne of the prime considerations when evaluating relational databases is
whether or not referential integrity is supported At its simplest this
means "can records referenced by other records (EG Customer references
related to invoices) be deleted whilst these references exist?" This is
such an obvious requirement that the question may seem facile The system
should not allow the deletion of a customer if there are several invoices on
hand for that customer Unfortunately AREV seems to miss this point and
permits the deletion of records WITH embedded foreign keys (although it will
prevent the modification of these records by hand)

Using the knowledge gained in last issue's indexing article it is however
possible to produce a piece of code which may be called FROM any pre delete
process to ensure that referential integrity is maintained The steps
involved are straightforward at delete time see if there are any "Related
From" INDEXES on file and if there are see if the fields referenced
thereby contain data If they do reject the delete request The code below
gives an EXAMPLE of how this information might be used to full advantage


SUBROUTINE INTEGRITY CHECK
$INSERT BP AREV COMMON
*
* Get INDEXES description record and look for all "Related To" index
* types (REVMEDIA Vol 2 Iss 1)
*
CHECK_REC = XLATE("!":DATAFILE "!":DATAFILE 1 "X")
LOOP
NEXT INDEX = CHECK REC[1 @SVM]
CHECK_REC = CHECK_REC[COL2()+1 999]
IF NEXT_INDEX[1 2] = "P$" THEN
*
* Field number in CURRENT records containing related data is in
* text mark 4
*
RELATED KEYS = "RECORD
IF RELATED KEYS THEN
*
* Construct warning message split over several lines due to
* width constraint of this format
*
MSG =DATAFILE:"Record ":@ID:" cannot be deleted"
FORMAT = "C#" : LEN(MSG)
MSG := @FM : "because it is related to" FORMAT
*
* Put name of related FROM file into FN
*
FN = NEXT_INDEX[3 @TM]
FN = XLATE("DICT " : DATAFILE FN 26 "X") [1 "*"]
MSG:= @FM: (:the following ":FN:" records:") FORMAT
MSG := @FM : RELATED KEYS FORMAT
CALL MSG(MSG "" "" "")
END
END
WHILE CHECK_REC
REPEAT
RETURN


(Volume 2 Issue 2 Page 4)
[revmedia/copyrigh.htm]

Page last modified: 30/01/03