thezip has asked for the wisdom of the Perl Monks concerning the following question:
I've been recently working on a small maintenance app for my shop, and have run across some issues with getting bind parameters to work.
As for the environment, I have a FreeBSD 5.3 box running Apache 2.0 and Perl 5.8, connecting to a MSSQL Server 2000 database. I installed the FreeTDS package and configured it to utilize DBD::Sybase as was detailed in CleverFox's tutorial (node 392385).
Everything works great (in the simplified query below) if I don't use the bind param -- but once I put it back in, I get the following message in my webserver error log:
[Tue Sep 05 16:06:01 2006] [error] [client 159.121.202.43] [Tue Sep 5 + 16:06:01 2006] jobmaint.pl: ct_send(CS_DESCRIBE_INPUT) returned 0 at + /usr/local/lib/perl5/site_perl/5.8.5/mach/DBD/Sybase.pm line 133., r +eferer: http://website/cgi-bin/jobmaint.pl?jobnum=51129
After searching the web for awhile, I found a few references to known issues with FreeTDS's parameter binding mechanism for DBD::Sybase.
I'm hoping that perhaps someone has also seen this issue and can suggest a specific workaround given my current environment.
Thanks in advance!
use strict; use DBI; use DBD::Sybase; my $CX = <...database connection info...> sub executeSelect { my($CX, $SQL, $params) = @_; my $resultset = []; # Get the database handle for the currently selected connection my $dbh = _getDBHandle($CX); my $sth = $dbh->prepare($SQL); my @params = @$params; for (my $I = 0; $I <= $#params; $I++) { $sth->bind_param($I + 1, $params[$I]); } $sth->execute(); while (my @row = $sth->fetchrow_array) { push(@$resultset, \@row); } return $resultset; } ### MAIN ### my $SQL = qq( SELECT JobN, JobDescription, CustomerOrderN, BookedDate, DueDate, Qu +antity FROM OpenJob WHERE JobN = ? ORDER BY DueDate desc); my $params = [ 68104 ]; my $records = executeSelect($CX, $SQL, $params);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bind Parameter Problem with DBD::Sybase and FreeTDS - Try DBD::ODBC with iodbc and freetds instead
by imp (Priest) on Sep 06, 2006 at 11:52 UTC |