Non-Disc Golf Stuff
Moderators: Timko, Solty, Frank Delicious, Blake_T, Fritz, Booter
by SkaBob » Thu Feb 18, 2010 3:20 pm
How can I insert a null value when using positional parameters?
- Code: Select all
my $sql = 'INSERT INTO foo (col1, col2) VALUES (?, ?)';
my $sth = $dbh->prepare($sql);
my $rc = $sth->execute($var1, $var2);
What can I put in the values of $var1 or $var2 above if I want to insert a null, rather than the string 'NULL', which tends to go asplodey when the column is an int or bool, or other non-text field?
I threw Wizards before they were cool.
-
SkaBob
- Disc Whore
-
- Posts: 3491
- Joined: Fri Mar 16, 2007 9:51 am
- Location: Detroit
- Favorite Disc: Comet
by SkaBob » Thu Feb 18, 2010 3:36 pm
n/m...solved it myself. Passing undef works.
I threw Wizards before they were cool.
-
SkaBob
- Disc Whore
-
- Posts: 3491
- Joined: Fri Mar 16, 2007 9:51 am
- Location: Detroit
- Favorite Disc: Comet
Return to Off-Topic, Miscellaneous, etc.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest