Reply to Re: What is MySQL for C union?

Your name:

Reply:


Posted by Andy Hassall on 10/13/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

[Back to original 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

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