From: Rudolph, Michael <Michael.Rudolph@telekom.de>
To: 'Michael A. Mayo' <mmayo@mcauleybrooklyn.org>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: AW: What is the difference between NULL and "undef"
Date: Fri, 19 May 2000 10:34:02 +0200
Message-ID: <EB8366869DABD2119F3200A0C9F02CC8016544EC@U8P27> (raw)
Thank you very much for your help. Unfortunately you had only nearly
the same solution as I had, so I have to accept it cannot be handled
directly in SQL.
Thank you too for your tip with the Perl DBI-book. I've already heard
of this book and tried to get it, but it is not yet available here in
germany. My application works now so far (a bit slow, but it works)
and I have learned by writing the program and receiving mails a lot
of programming SQL-applications.
Thanks again
Michael
-----Ursprüngliche Nachricht-----
Von: Michael A. Mayo [mailto:mmayo@mcauleybrooklyn.org]
Gesendet am: Donnerstag, 18. Mai 2000 23:10
An: Rudolph, Michael; 'Alessio Bragadini'
Cc: pgsql-sql@postgresql.org
Betreff: Re: [SQL] What is the difference between NULL and "undef"
----- Original Message ----- >
> If I set the variable $var3
> in line 5 in quotes, NULL wouldn't be interpreted in the right way.
> That solution works now, but it seems to me a bit fussy. And it is
> a lot of testing and transforming, when there are a lot of date-
> variables in the program.
Oops...I missed this last part. If you don't want to have to do the quoting
yourself, use the quote() method and make any empty strings undef instead
NULL.
$database = connect();
$name = $database->quote($var);
$database->do("insert into employees(name) values $var");
if $var is undef, it inserts null, if not it properly quotes the string,
including escaping any nasty characters it might include like the
apostrophe.
In the future, you might want to post questions like this to the dbi-users
list; you are more likely to get help there. Also, you may want to take a
look at the book "Programming the Perl DBI," or, if you are more harcore,
try the command "perldoc DBI." This stuff is pretty well documented in
both those resources.
-Mike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Michael.Rudolph@telekom.de, mmayo@mcauleybrooklyn.org
Subject: Re: What is the difference between NULL and "undef"
In-Reply-To: <EB8366869DABD2119F3200A0C9F02CC8016544EC@U8P27>
References: <EB8366869DABD2119F3200A0C9F02CC8016544EC@U8P27>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox