Re: [CDBI] Cascading Update

[prev] [thread] [next] [Date index for 2006/02/06]

From: Jay Hargreaves
Subject: Re: [CDBI] Cascading Update
Date: 23:26 on 06 Feb 2006
Sorry James - obviously I'm not making myself clear:

mysql> desc news;
+---------------+--------------+------+-----+------------+-------+
| Field         | Type         | Null | Key | Default    | Extra |
+---------------+--------------+------+-----+------------+-------+
| news_id       | varchar(50)  | NO   | PRI |            |       |
| date          | date         | NO   |     | 0000-00-00 |       |
| title         | varchar(50)  | NO   |     |            |       |
| summary       | varchar(250) | YES  |     | NULL       |       |
| story         | text         | NO   |     |            |       |
| news_category | varchar(50)  | NO   |     |            |       |
+---------------+--------------+------+-----+------------+-------+

mysql> desc newscategories;
+------------------+-------------+------+-----+---------+-------+
| Field            | Type        | Null | Key | Default | Extra |
+------------------+-------------+------+-----+---------+-------+
| news_category_id | varchar(50) | NO   | PRI |         |       |
| title            | varchar(50) | NO   |     |         |       |
| description      | text        | YES  |     | NULL    |       |
+------------------+-------------+------+-----+---------+-------+

So a News item has a NewsCategory and thus a NewsCategory has MANY News 
items...

My reasoning behind the change to the news_category_id was that I wanted 
something more readable as this is now to be used as part of a URL. In 
the previous configuration my main concern was to make the 
news_category_id unique and difficult to replicate - I didn't want 
people guessing at possible news_category_ids - thus I used an 
encryption of the datetime when the entry was created.

But now I am intending to use this as part of a URL I want something 
more intuitive - so the user can select all News items for a particular 
NewsCategory using something like:

http://www.example.com/cgi-bin/news.cgi?news_category_id=my_readable_id

Thus I came to modify the news_category_id only to find that doing so 
deleted all News items for this id!!

Hope this makes a bit more sense!

Thanks
Jay

yoorobot wrote:
> Jay Hargreaves wrote:
> 
>> Thanks for your reply James - I'm talking about the NewsCategory.id 
>> and so yes I'm talking about modifying a primary key. There must be 
>> some way to do this?
> 
> well now, I am even more confused.  I'm not sure why the NewsCategory id 
> even needs to change.  Perhaps you could post the schema and rephrase 
> your table relationships and how they are intended to interact.
> - James
> 
> 

        -- 
        bingo, bango, bosh...

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] Cascading Update
Jay Hargreaves 21:38 on 06 Feb 2006

Re: [CDBI] Cascading Update
yoorobot 22:14 on 06 Feb 2006

Re: [CDBI] Cascading Update
Jay Hargreaves 22:54 on 06 Feb 2006

Re: [CDBI] Cascading Update
yoorobot 23:05 on 06 Feb 2006

Re: [CDBI] Cascading Update
Jay Hargreaves 23:26 on 06 Feb 2006

Re: [CDBI] Cascading Update
.--- .- -- . ... 14:59 on 07 Feb 2006

Re: [CDBI] Cascading Update
Kingsley Kerce 22:20 on 06 Feb 2006

Re: [CDBI] Cascading Update
Jay Hargreaves 22:49 on 06 Feb 2006

Re: [CDBI] Cascading Update
Jay Hargreaves 15:02 on 07 Feb 2006

Generated at 23:19 on 12 Feb 2006 by mariachi v0.52