On Thu, 29 Dec 2005, Gary Thornock wrote:
I prefer client_id, both because the name matches when I use the
key as a foreign key in another table,

I understand this justification, although I personally prefer "id", but

and because there are frequently multiple $x_id fields in a table, and it's useful to distinguish between them.

I don't understand this justification. Are you saying that a table frequently has more than one primary key? Or are you saying that you prefer foreign keys to be of the format $x_id?

If the latter, unless I misunderstood, that was never under debate--I think everyone prefers $x_id for foreign keys. The argument is between:

(Table "foo" with two foreign key columns)
foo.foo_id
foo.bar_id
foo.baz_id

vs.

foo.id
foo.bar_id
foo.baz_id

As for having a base getID function, why not have one that knows
that the primary key field is always $tablename_id?

I agree; in actual code you can have it always prefix the table name when calling getID() or the like. This isn't really an issue IMO.

        ~ Ross

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to