On Thu, Dec 02, 2004 at 09:44:08AM +0000, Tim Bunce wrote:
> Seems odd that it breaks for all your customers but not for you.
> That implies that your test environment (which I presume you have)
> doesn't match that of your customers. That would need fixing.

It's hard to keep every database on every platform available, especially
when customers don't like to have their platforms dictated to them. I
ended up having to acquire new hardware to get a linux 9iR2 instance
up. Sorry it took so long.

> Until you can produce a small self-contained test case the reproduces
> the problem there's little more we can do.

Of course.  Attached is a small, (but not terribly clean) test script
that runs fine against 1.15/9iR2 and fails two tests against 1.16/9iR2.
Apparently, DBD::Oracle gets unhappy if the utf8 flag is turned on
manually using Encode.  Knowing this, I can now work around the issue,
but it would be cool if the issue could either be addressed in the docs
or code, as I've seen a number of other users running into this in
various fora online.

> But once you do have a test
> case that shows a problem we'll aim to get it fixed quickly.
 
use DBI;
use DBD::Oracle qw(:ora_types);
use Encode;
use Test::More qw/no_plan/;
# Table setup

my $dbh = DBI->connect('dbi:Oracle:HUALIEN', 'rt','rt');
$dbh->do('DROP TABLE example');
my $table = <<EOF;
CREATE TABLE example (
    id number (11,0),
    content clob
    )
EOF

$dbh->do($table);

my $content = "This is data in US-ASCII, which makes it valid UTF8, No?";
$content = Encode::decode_utf8($content);
my $sth = $dbh->prepare("INSERT INTO example (id,content) VALUES (1, ?)");
$sth->bind_param( 1, undef,
    { ora_field => 'content', ora_type => ORA_CLOB, ora_csid => 873 } );
@bind_values = ($content);
$sth->execute(@bind_values);

ok(!$sth->errstr,$sth->errstr);

my $fetch = $dbh->prepare("SELECT content FROM example WHERE id = 1");
$fetch->execute;
my $row = $fetch->fetchrow_arrayref();
is($row->[0], $content);


my $content = "This is data in US-ASCII, which makes it valid UTF8, No?";
Encode::_utf8_on($content);
my $sth = $dbh->prepare("INSERT INTO example (id,content) VALUES (2,?)");
$sth->bind_param( 1, undef,
    { ora_field => 'content', ora_type => ORA_CLOB, ora_csid => 873 } );
@bind_values = ($content);
$sth->execute(@bind_values);
ok(!$sth->errstr,$sth->errstr);


$fetch = $dbh->prepare("SELECT content FROM example WHERE id = 2");
$fetch->execute();
 $row = $fetch->fetchrow_arrayref();
is($row->[0], $content);

Reply via email to