[UPHPU] Table Relationships
Brandon Stout
bms at mscis.org
Fri Apr 6 14:57:36 MDT 2007
Mac Newbold wrote:
> I often don't set up the database to enforce my referential integrity
> (though I do have it enforce uniqueness, since that is more critical)
> because I find it really doesn't help me much. If I put the
> constraints in the database, then it kicks my queries back, and I've
> got to gracefully handle a wide variety of possible error situations,
> which takes more programming time and adds more complexity. The
> alternative is to check myself before I do the insert (which often has
> to be done anyway, and has already been checked), and fix it before I
> run a query that fails. Perhaps I just have a bias against failed
> queries, but I prefer to check it first and prevent it from failing
> rather than try it and see.
I remember reading somewhere, perhaps the 4.0 documentation, that this
is precisely why MySQL AB has not prioritized transaction capability in
MyISAM tables. They believe it should be enforced on the client side.
They have it slated for 5.2
because so many people want it.
Personally, I use MyISAM tables. When they support referential
integrity, I'll use it, but I'll also enforce on the client side.
Hopefully I wont miss anything on the client side, but if I do, the
database can enforce it.
I wonder if anyone has tried using triggers to make a MyISAM table
transaction capable...
Brandon Stout
http://mscis.org
More information about the UPHPU
mailing list