Puzzling error in 'prepare' call in DBI-SQLite
From: Jim Keenan (jkeen_via_google_at_yahoo.com)
Date: 10/20/04
- Next message: Tim Bunce: "Re: DBD::Oracle 1.15 core dump if RETURNING clause is used with LOB"
- Previous message: Marco Avvisano: "Re: Fwd: DBD::Informix A configuration failure"
- Next in thread: Jim Keenan: "Re: Puzzling error in 'prepare' call in DBI-SQLite"
- Reply: Jim Keenan: "Re: Puzzling error in 'prepare' call in DBI-SQLite"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Oct 2004 08:44:28 -0700
Using DBI to populate an SQLite database, I am encountering an error
in a 'prepare' call whose cause I cannot infer from the source code.
The database is called 'mall.db' and consists of about 6 tables, one
of which is called 'schedule'. All the tables have been created
successfully with 'CREATE TABLE'. All the other tables have been
populated with data via the 'INSERT INTO' command. There's nothing
particularly different about 'schedule' from the other tables, so I
can't figure out where my error is coming from. Here's the code:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my ($dbh, $sth);
my ($key, $room, $timeslot, $groupname,
$ward_department, $section, $instructor_key, $comment);
$dbh = DBI->connect("dbi:SQLite:dbname=L:/sqlite/mall.db", "", "",
{
PrintError => 0,
RaiseError => 1,
}) or die "Unable to connect to database: $DBI::errstr";
$dbh->do (qq{ DELETE FROM schedule } );
print "Got this far: 1\n";
# NEXT IS LINE 19: Error message says error occurs near "room":
$sth = $dbh->prepare( qq{ INSERT INTO schedule
(key room timeslot groupname
ward_department section instructor_key comment)
VALUES(?, ?, ?, ?, ?, ?, ?, ?) } );
print "Got this far: 2\n";
What get's printed to STDOUT is:
Got this far: 1
DBD::SQLite::db prepare failed: near "room": syntax error(1) at
dbdimp.c line 263 at schedule_demo.pl line 19.
I'm using Perl 5.8 on Win32. Both DBI and DBD::SQLite were installed
via .ppm files from ActiveState and have otherwise performed
satisfactorily. I have consulted the POD for DBI and DBD::SQLite as
well as the Perl DBI book, but have not been able to find out what
"syntax error(1)" might be. In addition, I've looked at dbdimp.c on
CPAN (http://search.cpan.org/src/MSERGEANT/DBD-SQLite-1.07/dbdimp.c),
but I don't understand enough about C yet to get a clue as to the
current error. I've also googled the archives of this list.
Can anyone see what's missing?
Thanks in advance.
Jim Keenan
- Next message: Tim Bunce: "Re: DBD::Oracle 1.15 core dump if RETURNING clause is used with LOB"
- Previous message: Marco Avvisano: "Re: Fwd: DBD::Informix A configuration failure"
- Next in thread: Jim Keenan: "Re: Puzzling error in 'prepare' call in DBI-SQLite"
- Reply: Jim Keenan: "Re: Puzzling error in 'prepare' call in DBI-SQLite"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|