RH wrote:

I have an app which connects via DBI:DBD:CSV to a flat file.
When I include pragma use encoding, the app aborts (message from OS and the
script is killed).
I found out that script is aborted during execute method of DBI.
The DB file has only ASCII characters. I use pragma encoding to display latin extended characters in Tk widget.



There is definitely something odd here and I'm afraid I don't know what it is yet. You may be able to put "no encoding" in blocks that use execute(), but I don't know what impact that will have on your Tk app.


I've narrowed the problem down to the DBD::File::Statement::open_table() method, but I don't know what is happening. For example this script works fine with the print statement, but gives a segfault if the print is omitted!

#!/usr/bin/perl -w
use strict;
use DBI;
use encoding 'latin2';
my $dbh = DBI->connect('dbi:CSV(RaiseError=1):');
for (split /;\n/,"
   DROP TABLE IF EXISTS x;
   CREATE TABLE x (y INT);
   INSERT INTO x VALUES(9);
") {
  my $sth = $dbh->prepare($_);
  print " " if /DROP/;   # <-- SEG FAULT IF COMMENTED OUT!!!!
  $sth->execute;
}
print "ok!\n" if 9 == $dbh->selectrow_array("SELECT * FROM x");
__END__



Reply via email to