|
Posted by Andy Hassall on 10/05/36 11:16
On Mon, 16 May 2005 16:41:28 -0700, "C.W.Holeman II"
<cwhii_googlespam@yahoo.com> wrote:
>What is the MySQL way of handling what is a union in C?
>
> typedef struct Step {
> int id;
> short type; /* STEP_PAGE, STEP_URL, STEP_PROJ,
> STEP_MANUAL */
> char title[128];
> char content[1024];
> union {
> char url[1024];
> int proj_id;
> } u;
> };
Two nullable columns, url and proj_id, and only set one of them in the row.
Something like:
create table step (
step_id int not null primary key,
step_type int not null,
title varchar(128) not null,
content text not null,
url text null,
proj_id int null
);
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|