in reply to Re: DBI bind params & column defaults
in thread DBI bind params & column defaults

Yes in fact it seems to be effectively the same. I hadnt found that thread in my poking around here. :(

In regard to Jenda's solution, it sounds specific to UPDATE queries. Any idea what'll happen on an insert query? I suppose i could just try it out myself!

Thanks much!

  • Comment on Re: Re: DBI bind params & column defaults

Replies are listed 'Best First'.
Re: Re: Re: DBI bind params & column defaults
by liz (Monsignor) on Oct 27, 2003 at 18:39 UTC
    You could use COALESCE just as well on INSERT. Something like:
    INSERT INTO table (id,type) VALUES ( id, COALESCE(?,defaulttypevalue) )
    Well, in general if a field is given the NULL value (which will be inserted if the given value for a placeholder is undef), then the database decides what to do with it. Usually it will just be marked as NULL in the database (as in: not having any value). Sometimes you can specify a default value when you create the table. Sometimes something special happens (e.g. with a TIMESTAMP field in MySQL).

    Liz