in reply to Re^3: Auto-Increment and DBD Agnosticism
in thread Auto-Increment and DBD Agnosticism
Most systems of this nature rely on the primary key as the natural unique identifier, I would really suggest you stick with that, and subclass for different DBDs.
I'm not sure that I entirely agree with that. It's legitimate to have another unique identifier. You just don't want to be using it as a foreign key in another table. The argument for having surrogate primary keys is that they are meaningless as anything except a row identifier, having no semantic meaning as far as your data is concerned, and thus are non-volatile and consequently safe to use for linking objects/rows together.
I agree with your assertion that subclassing is the right thing to do. I just don't think that the primary key has to be the only unique identifier. For example, think of a user table... The user id is going to be unique. It would be a bad idea to use it as a foreign key in link tables, but it would be unique all the same.
Anyway, I'm not sure what I'm arguing anymore... I didn't get enough sleep last night and am not entirely coherent. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Auto-Increment and DBD Agnosticism
by stvn (Monsignor) on Jun 24, 2004 at 13:59 UTC | |
by skyknight (Hermit) on Jun 24, 2004 at 15:23 UTC | |
by stvn (Monsignor) on Jun 24, 2004 at 15:52 UTC |