[sf-perl] Some well-formed XML?
ASIGMUND at altera.com
Tue Sep 20 13:39:09 PDT 2005
It might help to think of NULLs as the DBMS thinks of them, that is, not
as values themselves, but as the absence of a value in a column that
doesn't require a value. NULLability is an attribute of the column, and
a column of any data-type (VARCHAR, INT, DATETIME, etc.) may have this
attribute, and therefore not have a value, that is, "have a NULL value".
From: sanfrancisco-pm-bounces at pm.org
[mailto:sanfrancisco-pm-bounces at pm.org] On Behalf Of Joseph Brenner
Sent: Tuesday, September 20, 2005 13:23
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Some well-formed XML?
Rich Morin <rdm at cfcl.com> wrote:
> So, it's fairly straightforward to serialize a set of RDBMS
> tables as XML and load them back into another database. The
> rules for the (de-)serialization, however, will probably be
> hard-coded into your dumping and loading code.
Funny, I was just in the process of doing just this sort of thing.
In particular I'm noodling around how to preserve NULLs.
NULLs can be mapped to undefs in perl, which usually get mapped to
empty strings when written to some text format, but then that leaves
you with no way to distinguish between those and fields that started
out as empty (but non-NULL) VARCHARs.
So, you hack in code to translate the NULL/undefs to a string "NULL"?
Perhaps with additional hackery to preserve any odd ball strings
containing "NULL" to start with?
This is one of those things that I know has been solved a million
times, but I doubt I'm going to want to bug Ops to install some CPAN
modules to do it.
(By the way, has anyone noticed that XML::Simple can't always read
in the files that it writes? Fun.)
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
More information about the SanFrancisco-pm