This is my test script ph.pl:mysql> show create table t1 ; +-------+--------------------------------------------+ | Table | Create Table + | +-------+--------------------------------------------+ | t1 | CREATE TABLE `t1` ( `a` varchar(100) default 'TEST TABLE', `b` int(11) default '10' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 | +-------+-------------------------------------------+
Running this script gives:#! /usr/bin/perl use DBI; use strict ; my $dsn = "DBI:mysql:database=test;host=localhost"; my $dbh = DBI->connect($dsn, "root", ""); my $sth = $dbh->prepare("INSERT INTO t1 (a,b) VALUES(?,?)") ; my @a = (undef,undef ) ; $sth->execute(@a) ; $dbh->disconnect() ;
So there is no NULL for column a!mysql> select * from t1 ; +------+------+ | a | b | +------+------+ | | NULL | +------+------+ 1 row in set (0.00 sec)
In reply to Re^2: MySQL: placeholders and NULL values
by jeanluca
in thread MySQL: placeholders and NULL values
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |