in reply to Re^2: MySQL: placeholders and NULL values
in thread MySQL: placeholders and NULL values

Did you miss my answer? The DEFAULT value only comes into play when you do an INSERT without naming that column.

Update: the MySQL docs say you can also do INSERT INTO t1 VALUES (DEFAULT, 20) to force the default value for a particular column. I'm not sure how you do that via DBI.


Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^4: MySQL: placeholders and NULL values
by cwry (Monk) on May 03, 2006 at 00:37 UTC
    Did you miss the question? It asks how to set a column to NULL with placeholders, not set it to the default. NULL may or may not be the default for a column.
      The OP had this:
      $cols[0] = undef ; # gives default value of that column
      which I have shown to be untrue. Doing that WILL set it to NULL.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart