Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re^2: DBD::mysql Unusual Behavior

by bart (Canon)
on Aug 23, 2002 at 20:13 UTC ( #192434=note: print w/replies, xml ) Need Help??


in reply to Re^2: DBD::mysql Unusual Behavior
in thread DBD::mysql Unusual Behavior

The concern is that the value will be undefined which is going to generate warnings if used.

Eh, no. Not in this particular case, anyway. The thing is that DBI's placeholder mechanism will convert every undef into the unquoted string "NULL", so that

INSERT INTO FOO (foo) VALUES (?)
will effectively mean
INSERT INTO FOO (foo) VALUES (NULL)

And some people's database setup will complain about that, if the field isn't allowed to be NULL. Personally, I like NULLs in my databases, for values that indeed have no value.

Replies are listed 'Best First'.
Re^4: DBD::mysql Unusual Behavior
by tadman (Prior) on Aug 23, 2002 at 20:39 UTC
    The NULL fields actually consume an astounding extra bit per record, so while they're convenient and all, if the difference between "empty" and NULL is trivial, it's often easier to just throw in an empty value.

    Since the column in question was not allowed to be NULL, you're required to check before INSERTion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://192434]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2019-11-20 10:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (96 votes). Check out past polls.

    Notices?