in reply to Re: MySQL: placeholders and NULL values
in thread MySQL: placeholders and NULL values
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: MySQL: placeholders and NULL values
by bart (Canon) on May 02, 2006 at 14:39 UTC | |
by jeanluca (Deacon) on May 02, 2006 at 14:52 UTC | |
|
Re^3: MySQL: placeholders and NULL values
by japhy (Canon) on May 02, 2006 at 14:53 UTC | |
by cwry (Monk) on May 03, 2006 at 00:37 UTC | |
by japhy (Canon) on May 03, 2006 at 05:12 UTC |