John W. Colby
jcolby at colbyconsulting.com
Sat Feb 8 15:32:00 CST 2003
Rocky, What I was saying the other day is simply that cascade delete has no ability to assess the "rights" of the person deleting something. The alternative in your situation is to build a set of queries that join: Rental Agreement to CheckInOut RentalAgreement to ItemsSold RentalAgreement to Labor and finally RentalAgreement with SubRental (subsystem) by setting a where clause under the RentalAgreement PK or other defining field and turning each of these into a delete query, you delete the child items to RentalAgreement. One by one, you delete the child records (Checkout, ItemsSold, Labor, and Subrental). Once the child records are gone, you delete the RentalAgreement. Of course cascade delete is free. And of course building these queries is work. But... now that you have these queries you can use various strategies to determine who gets to delete the RentalAgreement and it's children, and equally important, who doesn't. I pretty much agree with Arthur, deleting records is mostly inappropriate in a database. In any event, the ability (right) to do so should rest in the hands of VERY senior people, not just the person behind the cash register. Cascade delete, by it's nature can't differentiate. If it's enabled, my cat walking across the keyboard could (theoretically) delete a record (or worse a thousand records in a dozen different child directories). When I was working down in Mexico I had an experience that forever changed my view of the user interface. In Mexico companies often hire what we would almost call "manservants" - uneducated "lower class" workers to do simple things like run around town doing things, and of course cleaning. I came back from lunch one day to find the cleaning lady cleaning the keyboard of the computer... that happened to be in a record of real data (well, used to be real anyway). Fields Across the form were filled with !!!!!!!!@@@@@@@@########$$$$$$%%%%% and QQQQWWWWWWWWWEEEEEEEEEEEEERRRRRRTTTTTTTTTYYYYYY - whatever keys she had been diligently rubbing the dirt off of. That opened my eyes to the damage that can be done quite unexpectedly in a database. She had no authorization to edit records, nor delete data. But she was doing her job, and there she was editing my real user's data. And she could just as easily have deleted your rental records while she cleaned the keyboard.