Subject: | bind_param_array with attributes broken |
Failing test attached.
The error is:
DBD::InterBase::st bind_param_array failed: You have not provided a
value for non-nullable parameter #0. at ...
If I remove the code portion that checks for nullable fields, then it works.
This happens ONLY with a non-empty $attr to bind_param_array, even if
it's just {}.
Subject: | 92bind_param_array_with_attr.t |
#!/usr/bin/perl -w
# $Id: 91txinfo.t 372 2006-10-25 18:17:44Z edpratomo $
# test for ib_tx_info()
use strict;
use DBI;
use Test::More tests => 8;
# Make -w happy
$::test_dsn = '';
$::test_user = '';
$::test_password = '';
my $file;
do {
if (-f ($file = "t/InterBase.dbtest") ||
-f ($file = "InterBase.dbtest"))
{
eval { require $file };
if ($@) {
diag("Cannot execute $file: $@\n");
exit 0;
}
}
};
sub find_new_table {
my $dbh = shift;
my $try_name = 'TESTAA';
my %tables = map { uc($_) => 1 } $dbh->tables;
while (exists $tables{$try_name}) {
++$try_name;
}
$try_name;
}
my $dbh1 = DBI->connect($::test_dsn, $::test_user, $::test_password);
ok($dbh1);
my $table = find_new_table($dbh1);
ok($dbh1->do(<<"EOF"));
CREATE TABLE $table (
ID INT NOT NULL PRIMARY KEY,
CHARFIELD VARCHAR(100) NOT NULL
)
EOF
ok(my $sth1 = $dbh1->prepare(<<"EOF"));
INSERT INTO $table (ID, CHARFIELD) VALUES (?, ?)
EOF
# the {} on the end is CRITICAL
ok($sth1->bind_param_array(1, [qw/1 2 3 /], {}), 'bind_param_array');
ok($sth1->bind_param_array(2, [qw/Foo Bar Baz/], {}), 'bind_param_array');
is $sth1->execute_array({}), 3, 'execute_array';
ok($dbh1->do("DROP TABLE $table"));
ok($dbh1->disconnect);