Skip Menu |

This queue is for tickets about the DBD-CSV CPAN distribution.

Report information
The Basics
Id: 20550
Status: resolved
Priority: 0/
Queue: DBD-CSV

People
Owner: Nobody in particular
Requestors: RENEEB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.22
Fixed in: (no value)



Subject: Using "Primary key" leads to error
Defining a PRIMARY KEY causes an error. You should parse it and forget it. I want to use PRIMARY KEY in my script due to maintenance reasons. This works: #!/usr/bin/perl use strict; use warnings; use DBI; my $statement = q~CREATE TABLE test(test INT)~; my $dbh = DBI->connect("DBI:CSV:f_dir=/path/to/files/;csv_sep_char=\\;","",""); $dbh->do($statement); But this code doesn't work: #!/usr/bin/perl use strict; use warnings; use DBI; my $statement = q~CREATE TABLE test(test INT, PRIMARY KEY (test))~; my $dbh = DBI->connect("DBI:CSV:f_dir=/path/to/files/;csv_sep_char=\\;","",""); $dbh->do($statement); I get the followin output: ~/entwicklung 42> perl dbd_csv_bug.pl SQL ERROR: Bad table or column name 'PRIMARY' is a SQL reserved word! Execution ERROR: No command found!.
This falls outside of the scope of DBD::CSV, and has been resolved in more recent versions of the required modules $ cat sandbox/rt20550.pl #!/pro/bin/perl use strict; use warnings; use DBI; unlink "sandbox/test"; my $dbh = DBI->connect ("DBI:CSV:f_dir=sandbox;csv_sep_char=\\;","",""); $dbh->do ("CREATE TABLE test (test INT, PRIMARY KEY (test))"); print "DBI: $DBI::VERSION\n"; print "SQL::Statement: $SQL::Statement::VERSION\n"; $ perl -Ilib sandbox/rt20550.pl DBI: 1.607 SQL::Statement: 1.20 $