You are here: Re: seperator instead of a comma for listed items in DB? « All PHP « IT news, forums, messages
Re: seperator instead of a comma for listed items in DB?

Posted by Oli Filth on 04/21/06 15:38

JDS wrote:
> On Mon, 17 Apr 2006 08:12:58 -0700, news@celticbear.com wrote:
>
> > Nearly every punctuation has a chance of being in the actual data. Any
> > suggestions?
>
> You can use a multi-character separator.
>
> @@@
>
> or
> @!@
>
> or
>
> THIS_IS_THE_SEPARATOR
>

IMO (and in my experience), relying on the assumption that certain
combinations characters won't appear in the actual data is just an
accident waiting to happen (I've had disastrous experiences based on
that assumption). Admittedly, @@@ or whatever is extremely unlikely to
appear in an ingredients list, but nevertheless...

If one must violate 1NF like this, I would recommend using a single
delimiter, such as a comma. If a literal comma ever occurs in the
actual data, it should be delimited by some means, e.g.:

Eye of toad
Leg, arm of newt
Brain of goat

becomes:

Eye of toad, Leg\, arm of newt, brain of goat

Separating the data on a read will become slightly more complicated
than a simple explode(), but it will be guaranteed to work in all
situations (I think).

But having said all this, by far the best option is not violating 1NF
in the first place, by storing this information atomically in a
separate table.


--
Oli

 

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

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