select through DBD::CSV
- From: rh62121@xxxxxxxxx (Radomir Hejl)
- Date: Sat, 23 Apr 2005 21:41:26 +0200
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";
__END__
The script prints 'line: ¹¹ 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
Why doesn't LIKE operator match the data when encoding pragma (any) is used?
Thank you for suggestions.
Radek H.
.
- Follow-Ups:
- UTF8 in CSV (was Re: select through DBD::CSV)
- From: Jeff Zucker
- UTF8 in CSV (was Re: select through DBD::CSV)
- Prev by Date: Problems building DBI on Windows
- Next by Date: Re: Transaction handling with Oracle DBD
- Previous by thread: select through DBD::CSV
- Next by thread: UTF8 in CSV (was Re: select through DBD::CSV)
- Index(es):
Relevant Pages
|
|