Re: Too much integrity?
- From: Jamie Collins <jamiecollins@xxxxxxxxxx>
- Date: Mon, 24 Sep 2007 01:53:12 -0700
On Sep 23, 1:28 am, Phil <.@.> wrote:
Jamie Collins wrote:
...Agreed, it sounds like multiple 1:1 relationships between the
'items' and the specialist lists' items...
Actually, Pat's earlier message convinced me that what I have IS an m2m
relationship, only I wasn't seeing it that way.
I'm still not not seeing it that way but it's your model :)
The underlying problem is that the SQL language has no concept of
multiple assignment and although the SQL-92 standard includes
deferrable constraints Jet does not support them.
I'm not 100% sure what that means, but I'm pretty sure I could work
around my problem with transactions - if I were at the point of writing
code; but apparently Access has no way of manually starting or ending a
transaction. So far, I've been doing my testing by removing the
relationships, adding test data, and recreating the relationships
afterward - which is a pain in the neck.
You can indeed explicitly start a transaction e.g. ANSI-92 Query Mode
syntax supports BEGIN TRANSACTION, COMMIT TRANSACTION and ROLLBACK
TRANSACTION. The problem you'll have is that instead of being able to
defer constraints (possible with full SQL-92 syntax SET CONSTRAINTS
<constraint names list> DEFERRED) you would have to DROP the
constraints within the transaction, which would cause a table lock.
Further note that a Jet PROCEDURE can only comprise one SQL statement,
whereas the above logic requires at least six SQL statements e.g.
pseudo code:
BEGIN TRANSACTION
;
ALTER TABLE MyTable DROP CONSTRAINT my_constraint
;
-- sql update(s) here e.g.
INSERT INTO MyTable (my_col) VALUES (0)
;
ALTER TABLE MyTable ADD CONSTRAINT my_constraint CHECK (...);
;
-- adding a constraint does not necessarily mean
-- it will get checked, therefore do something to
-- trigger it here e.g.
UPDATE MyTable
SET my_col = my_col
;
COMMIT TRANSACTION
;
The mechanisms to execute multiple statements in appropriate order,
control of flow, error handling etc must be done in the 'front end'
rather than SQL code :(
Jamie.
--
.
- Follow-Ups:
- Re: Too much integrity?
- From: Jamie Collins
- Re: Too much integrity?
- References:
- Re: Too much integrity?
- From: Pat Hartman \(MVP\)
- Re: Too much integrity?
- From: Jamie Collins
- Re: Too much integrity?
- Prev by Date: Re: Auto-update frontends???
- Next by Date: Re: Too much integrity?
- Previous by thread: Re: Too much integrity?
- Next by thread: Re: Too much integrity?
- Index(es):
Relevant Pages
|