|
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]
|