RE: [Arsperl-users] FW: DBI error on bind_columns
Brought to you by:
jeffmurphy
|
From: Richard H. <rl...@ls...> - 2005-05-18 15:43:56
|
Kelly,
Where's the code that calls your "bind_columns" function?
Cheers,
Richard.
_____
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Kelly Logan
Sent: 18 May 2005 14:43
To: ars...@ar...
Subject: [Arsperl-users] FW: DBI error on bind_columns
G'day all,
This is an odd one. I have a script that uses DBD:ODBC to connect to an SQL
Server database and run some queries.
I modified one of the queries, adding another table and field to the total:
Before
-------------
select t1.plannbr_fi, t1.domain_ind, t2.fname, t2.lname, t3.fname, t3.lname,
t4.gso_code_alpha,
t5.notepad, t6.market_region_name
from (((((plan_base t1 LEFT OUTER JOIN staff_gso t2 ON
t1.id_sales_rep = t2.rep_id_idnty)
LEFT OUTER JOIN staff_gso t3 ON t1.id_acct_mgr =
t3.rep_id_idnty)
LEFT OUTER JOIN gso_offices t4 ON t1.gso_idnty =
t4.gso_idnty)
LEFT OUTER JOIN plan_notepad t5 ON t1.plannbr_idnty =
t5.plannbr_idnty)
LEFT OUTER JOIN regions_ops t6 ON t1.ops_region_idnty =
t6.ops_region_idnty)
where ...
After
-------------
select t1.plannbr_fi, t1.domain_ind, t2.fname, t2.lname, t3.fname, t3.lname,
t4.gso_code_alpha,
t5.notepad, t6.market_region_name, t7.bus_name
from ((((((plan_base t1 LEFT OUTER JOIN staff_gso t2 ON
t1.id_sales_rep = t2.rep_id_idnty)
LEFT OUTER JOIN staff_gso t3 ON t1.id_acct_mgr =
t3.rep_id_idnty)
LEFT OUTER JOIN gso_offices t4 ON t1.gso_idnty =
t4.gso_idnty)
LEFT OUTER JOIN plan_notepad t5 ON t1.plannbr_idnty =
t5.plannbr_idnty)
LEFT OUTER JOIN regions_ops t6 ON t1.ops_region_idnty =
t6.ops_region_idnty)
-> LEFT OUTER JOIN specialty_risk_names t7 ON t1.id_tpa =
t7.srisk_idnty)
where ...
After adding this line into the query, the script no longer ran, giving me
the following error:
bind_columns called with 9 refs when 10 needed. at C:/Perl/site/lib/DBI.pm
line
1787.
Here's that section of code in DBI.pm:
sub bind_columns {
my $sth = shift;
my $fields = $sth->FETCH('NUM_OF_FIELDS') || 0;
if ($fields <= 0 && !$sth->{Active}) {
return $sth->set_err(1, "Statement has no result columns to bind"
." (perhaps you need to successfully call execute first)");
}
# Backwards compatibility for old-style call with attribute hash
# ref as first arg. Skip arg if undef or a hash ref.
my $attr;
$attr = shift if !defined $_[0] or ref($_[0]) eq 'HASH';
1787-> die "bind_columns called with ".@_." refs when $fields needed."
if @_ != $fields;
my $idx = 0;
$sth->bind_col(++$idx, shift, $attr) or return
while (@_);
return 1;
}
Is there a max on the fields that can be passed?
Kelly Logan
Rapid Technologies
(313) 645-4552
kel...@ra...
|