Hi all,

I've tried this with 1.23 and 1.27 so it has probably been fixed long ago
but in case it hasn't ...

Consider the following script :

#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;
use Encode;

sub main {
    my $dbh = DBI->connect(
        'dbi:Oracle:',
        'usr/pwd@instance',
        '',
        { PrintError => 0, AutoCommit => 0, RaiseError => 1, },
        );
    print {*STDERR} 'Connected !', "\n";
    $dbh->do(q(alter session set nls_territory = 'GERMANY'));
    my $sql = <<'END_SQL';
SELECT  ltrim(rtrim(to_char(0, 'L')))
FROM    dual
END_SQL
    my $sth = $dbh->prepare($sql);
    $sth->execute;
    my ($val);
    $sth->bind_columns(\($val));
    while ($sth->fetch) {
        print {*STDERR} 'val=[', $val, '] len=', length($val), "\n";
    }
    if (Encode::is_utf8($val)) {
        print {*STDERR} ' utf8 is on', "\n";
    } else {
        print {*STDERR} ' utf8 is off', "\n";
    }
    $sth->finish;
    $sql = <<'END_SQL';
declare
    l_ret       varchar2(10);
begin
    select  ltrim(rtrim(to_char(0, 'L')))
    into    l_ret
    from    dual;
    --
    :ret := l_ret;
end;
END_SQL
    undef $val;
    $sth = $dbh->prepare($sql);
    $sth->bind_param_inout(':ret', \$val, 100);
    $sth->execute;
    print {*STDERR} 'val=[', $val, '] len=', length($val), "\n";
    if (Encode::is_utf8($val)) {
        print {*STDERR} ' utf8 is on', "\n";
    } else {
        print {*STDERR} ' utf8 is off', "\n";
    }
    $dbh->disconnect;
    return 0;
}

exit main();

Here's the output :

[stbaldwin@audev01 dev][2]$ ./sb2.plx
Connected !
val=[€] len=1
 utf8 is on
val=[â ¬] len=3
 utf8 is off

I know I can fix this myself but was wondering if it is considered a 'bug'
and if so, whether it has been fixed in a more recent version of
DBD::Oracle.

Thanks,

Steve


---------------------------------------------------------------------------------------
This email is intended solely for the use of the addressee and may
contain information that is confidential, proprietary, or both.
If you receive this email in error please immediately notify the
sender and delete the email.
---------------------------------------------------------------------------------------

Reply via email to