in reply to Tie::DBI question
You may want to make better fake values than I've used -- I just created a new table with a single datetime column.use POSIX qw(strftime); my $now_string = strftime "%Y-%m-%d %H:%M:%S", localtime; use DBI; my $dbh = DBI->connect('DBI:mysql:foothills', 'root', '') or die; my $sth = $dbh->prepare("INSERT INTO users values('test', 'test', 1, 1 +, 1, 1, ?)"); $sth->execute($now_string); $dbh->disconnect();
If that insert works, the problem's probably somewhere in Tie::DBI. Yuck.
Update: The problem *is* in Tie::DBI, specifically within the _fields() method. It checks the allowed column names from the database, then issues the statement:
my %fields = map { lc($_)=>1 } @{$sth->{NAME}};
The lc there is the trouble.
If you add WARN => 1 to the tie statement, you'll get a warning about an unknown field named 'dateCreated' in the initialization line.
The solution is either to remove the lc() from Tie::DBI, or to use lowercase keys in the anonymous hash. Perhaps some databases don't support mixed case in field names, so Dr. Stein thought he would be safer than sorry.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tie::DBI question
by tmbg (Novice) on May 07, 2001 at 06:05 UTC |