You are here: Re: Updating the SQL key value « PHP Programming Language « IT news, forums, messages
Re: Updating the SQL key value

Posted by Toby A Inkster on 03/31/07 21:04

Erwin Moller wrote:

> Consider this example:
> 1) Your tbluser as described above by you.
> 2) a collection of articles written by that user
>
> CREATE TABLE tblarticle(
> articleid serial PRIMARY KEY,
> writtenby login REFERENCES tbluser(login),
> content VARCHAR(10000)
> )
>
> I made a FK as you see.
> Now what happens if that user wants a new loginname?
>
> You are forced to update this new loginname everwhere in your database where
> you use it.
> Or do you use cascading?
> (I dislike cascading though all FK constraints, but it is of course
> possible)

I do indeed use cascading. But I'd be tempted not to allow users to change
login anyway, as it would probably result in URL changes, which I try to
avoid as much as possible.

> What happened to good old nextval()?

This particular project aims at supporting PostgreSQL, MySQL, Firebird, MS
SQL Server and Oracle. PostgreSQL sequences are nice, but
PostgreSQL-specific.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация