tmbg has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Tie::DBI to insert records into a MySQL database with a hash
All is well, except inserting dates doesn't work properly
use Tie::DBI; my %user_table; my $t = tie %user_table,'Tie::DBI', { db => "mysql:music_server", user => "root", password => "", table => "users", key => "nick", CLOBBER => 1, }; use POSIX qw(strftime); my $now_string = strftime "%Y-%m-%d %H:%M:%S", localtime; $user_table{$nick} = { hostmask => $hostmask, level => $level, credits => $level, moderates => $moderates, dateCreated => $now_string, );
This works great, I get a brand new row inserted into my table, but no
matter what I give to dateCreated, it always turns up NULL.
here is the description of the table
mysql> describe users; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | nick | varchar(15) | | PRI | | | | hostmask | text | YES | | NULL | | | level | int(11) | YES | | 100 | | | credits | int(11) | YES | | 0 | | | moderates | int(11) | YES | | 3 | | | songsPlayed | int(11) | YES | | 0 | | | dateCreated | datetime | YES | | NULL | | +-------------+-------------+------+-----+---------+-------+
Hope someone has some pointers!
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tie::DBI question
by chromatic (Archbishop) on May 07, 2001 at 03:49 UTC | |
by tmbg (Novice) on May 07, 2001 at 06:05 UTC | |
|
Re: Tie::DBI question
by tmbg (Novice) on May 07, 2001 at 07:37 UTC | |
by merlyn (Sage) on May 07, 2001 at 07:46 UTC | |
by geektron (Curate) on Jun 28, 2005 at 22:37 UTC |