Test case from ribasushi:
use strict;
use warnings;
use DBI;
use Test::More;
use Test::Exception;
my $dbh = DBI->connect(@ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER
PASS/}, { AutoCommit => 1, RaiseError => 1 });
$dbh->do('DROP TABLE "bindtype_test"');
$dbh->do('CREATE TABLE "bindtype_test" ("id" integer NOT NULL, "blob"
blob NULL )');
lives_ok {
$dbh->prepare('INSERT INTO "bindtype_test" ("id") VALUES
(?)')->execute(1);
};
lives_ok {
$dbh->prepare('INSERT INTO "bindtype_test" ("id", "blob") VALUES (?,
?)')->execute(2, 'abc');
};
lives_ok {
my $sth = $dbh->prepare('INSERT INTO "bindtype_test" ("id", "blob")
VALUES (?, ?)');
$sth->bind_param(1, 3);
$sth->bind_param(2, 'abc', { ora_type => DBD::Oracle::ORA_BLOB(),
ora_field => 'blob'} );
$sth->execute;
};
lives_ok {
my $sth = $dbh->prepare('INSERT INTO "bindtype_test" ("id", "blob")
VALUES (?, ?)');
$sth->bind_param(1, 4);
$sth->bind_param(2, 'abc', { ora_type => DBD::Oracle::ORA_BLOB(),
ora_field => '"blob"'} );
$sth->execute;
};
done_testing;
t/73oracle.t ..
ok 1
ok 2
not ok 3
DBD::Oracle::st execute failed: ORA-01740: missing double quote in
identifier
ORA-01740: missing double quote in identifier (DBD SUCCESS:
OCIDescribeAny(view)/LOB refetch) [for Statement "INSERT INTO
"bindtype_test" ("id", "blob") VALUES (?, ?)" with ParamValues: :p1=3,
:p2='abc'] at t/73oracle.t line 26.
# Failed test at t/73oracle.t line 27.
# died: DBD::Oracle::st execute failed: ORA-01740: missing double quote
in identifier
# ORA-01740: missing double quote in identifier (DBD SUCCESS:
OCIDescribeAny(view)/LOB refetch) [for Statement "INSERT INTO
"bindtype_test" ("id", "blob") VALUES (?, ?)" with ParamValues: :p1=3,
:p2='abc'] at t/73oracle.t line 26.
not ok 4
1..4
DBD::Oracle::st execute failed: ORA-01740: missing double quote in
identifier
ORA-01740: missing double quote in identifier (DBD SUCCESS:
OCIDescribeAny(view)/LOB refetch) [for Statement "INSERT INTO
"bindtype_test" ("id", "blob") VALUES (?, ?)" with ParamValues: :p1=4,
:p2='abc'] at t/73oracle.t line 33.
# Failed test at t/73oracle.t line 34.
# died: DBD::Oracle::st execute failed: ORA-01740: missing double quote
in identifier
# ORA-01740: missing double quote in identifier (DBD SUCCESS:
OCIDescribeAny(view)/LOB refetch) [for Statement "INSERT INTO
"bindtype_test" ("id", "blob") VALUES (?, ?)" with ParamValues: :p1=4,
:p2='abc'] at t/73oracle.t line 33.
# Looks like you failed 2 tests of 4.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/4 subtests
Test Summary Report
-------------------
t/73oracle.t (Wstat: 512 Tests: 4 Failed: 2)
Failed tests: 3-4
Non-zero exit status: 2
Files=1, Tests=4, 1 wallclock secs ( 0.02 usr 0.01 sys + 0.32 cusr
0.05 csys = 0.40 CPU)
Result: FAIL
Martin
--
Martin J. Evans
Wetherby, UK