Home: Perl Programming Help: DBI:
INSERT error into table with COLLATE keyword



trs319843
New User

Aug 16, 2011, 2:21 AM


Views: 10469
INSERT error into table with COLLATE keyword

Hello,

I am trying to INSERT into a table as follows -

Code
# Open configdb db of that version 
$dbc = DBI->connect("dbiQLite:$confdbfname")
|| die "Cannot connect DBI::errstr";

$stmtc = <<EOS;
INSERT INTO domain_info
(is_anon_bind, domain, type, nc_id)
values
(?,?,?,?)
EOS

$stmthc = $dbc->prepare($stmtc) || die "Cannot prepare DBI::errstr";


The schema of the table is as follows -

Code
CREATE TABLE domain_info ( 
domain_id INTEGER PRIMARY KEY AUTOINCREMENT,
is_anon_bind INTEGER,
domain TEXT COLLATE NOCASE NOT NULL,
type INTEGER,
nc_id INTEGER,
user TEXT COLLATE NOCASE,
userdomain TEXT COLLATE NOCASE,
password TEXT,
dc TEXT,
custom_attr TEXT);
CREATE UNIQUE INDEX domain_name ON domain_info(domain);


But, I am getting error as follows -

Code
DBD:QLite::db prepare failed: malformed database schema - near "COLLATE": syntax error(11) at dbdimp.c line 271 at mxload.pl lin 
at mxload.pl line 914
main::do_users(1, 'C:\DataInsight\sim', 'HASH(0x378930)') called at mxload.pl line 175
main::do_main() called at mxload.pl line 1309
Cannot prepare DBI::errstr at mxload.pl line 914.
at mxload.pl line 914
main::do_users(1, 'C:\DataInsight\sim', 'HASH(0x378930)') called at mxload.pl line 175
main::do_main() called at mxload.pl line 1309


Any help on this would be highly appreciated !

Thanks in advance...

Cheers,
trs319843