select through DBD::CSV



Hi,
this is my test script:

use DBI;
use encoding 'utf-8';
use strict;
use warnings;
my ($dbh,$sth,$col1,@test);
$dbh = DBI->connect("DBI:CSV:csv_sep_char=\\|;",{RaiseError => 1})
or die "Cannot connect: " . $DBI::errstr;
$sth = $dbh->prepare("SELECT * FROM test WHERE col1 = ?")
or die "Cannot prepare: " . $DBI::errstr;
$col1 = 'šš';
$sth->execute($col1) or die "Cannot execute: " . $DBI::errstr;
@test = $sth->fetchrow_array;
$sth->finish;
$dbh->disconnect;
print "line: @test\n";

The script prints šš zz. (š = latin small letter s with
caron)
test db and script encoding are the same.

test db lines:
col1|col2
šš|zz

1. if I remove encoding pragma data is retrieved
2. if I remove encoding pragma and replace comparison operator = with
LIKE operator data is retrieved
3. if I enclude encoding pragma with LIKE operator in select there is
no match - WRONG
4. if I enclude encoding pragma with LIKE operator in select and use
ASCII characters in where, e.g for col2, data is retrieved

What's the reason or is it a bug in DBD::CSV?

Thank you for suggestions.
Radek H.
.



Relevant Pages

  • select through DBD::CSV
    ... this is my test script: ... test db and script encoding are the same. ... if I remove encoding pragma and replace comparison operator = with LIKE ... Why doesn't LIKE operator match the data when encoding pragma is used? ...
    (perl.dbi.users)
  • hebrew encoding
    ... I am having encoding nightmare. ... I have a simple test script: ... encoding system iso8859-8 ...
    (comp.lang.tcl)