On Wed 13 Feb 2002 22:52, Jonathan Leffler <[EMAIL PROTECTED]> wrote:
> I've been emulating a pseudo-SQL command, UNLOAD, in DBI and
> DBD::Informix, and one of the messy parts is handling the mapping of
> undef into an empty string so as not to get warnings with 'perl -w'.
> I've also routinely encountered this as a usability problem in ordinary
> operation - and DBD::Informix testing.  Would there be any merit in
> having a DBI-wide mechanism that identifies whether the SQL NULL
> non-values should be mapped to Perl undef or to a defined string -
> probably the empty string?

I've been asking for this for ages :) but for the opposite reason: Storing an
empty string in an Oracle varchar field renders it to NULL inside the database.

> Here are some code fragments.  The basic UNLOAD format is a text string
> for each field, followed by a user-selectable delimiter, default '|'.
> Each record ends with a newline.  Backslash is used as the escape
> character: backslash, newline and delimiter.  The 'byte blob' encoding
> is ghastly (but simple), and doesn't affect my discussion.
> <snip>
> If there's any significant resistance or lack of consensus, I'll simply
> add an Informix-specific attribute that deals with this issue (settable
> per $dbh and inherited by $sth, overridable per $sth).  OTOH, I suspect
> I'm not the only person to have noticed that this is a (minor) usability
> problem and maybe having it standardized would be of benefit to most
> users.
> 
> What say you?

Nuke NULL! (Worldwide!) Use *anything* you can get your hands on to do so.

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 630 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/

Reply via email to