Hello Monks,

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);
Where do you want *them* to go today?

In reply to Bind Parameter Problem with DBD::Sybase and FreeTDS by thezip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.