[freetds] Parameter Passing does work

Philip philip_38 at hotmail.com
Wed Jun 15 14:15:54 EDT 2005


The explanations is unreal because Perl is working perfectly now in one of
my machines. What I did was to replicate the entire machine and use it for
the next clients, because I could not find the reason. I hereby invite jkl
to email me and I will invite him to log in via putty and using the Linux
utility screen I can show how my "testsql.pl" script (below) works and
retrieves all the parameter variables correctly. I can not explain why but
it works.
The proof of the pudding is eating it.

#!/usr/bin/perl

use strict;
use DBI;
my $server = "";
my $db = "minixel";
my $username = "sa";
my $password = "";

my $dbh = DBI->connect("dbi:Sybase:minixel:6976", $username ', $password ',
{PrintError => 0});
die "Unable for connect to server $DBI::errstr"
    unless $dbh;
$dbh->do("use $db");
my $query = "select host_name() declare \@minPriceBook varchar(100),
\@maxPriceBook  varchar(100)
exec sp_GetBooksByPrice \@minPrice =2.00 , \@maxPrice = 20.00,
\@lowestPricedBook = \@minPriceBook OUTPUT, \@highestPricedBook  =
\@maxPriceBook OUTPUT";
my $sth = $dbh->prepare($query);
          $sth->execute();

do {
      while(my $dat = $sth->fetch) {
print "TYPE $sth->{syb_result_type}\n";
print "Data @$dat[0] , @$dat[1] , @$dat[2] \n";
         if($sth->{syb_result_type} == 4042) { # it's a PARAM result
           print "Number:  $dat->[0]  \n";
            print "Varpar:  $dat->[1]  \n";
         }
      }
   } while($sth->{syb_more_results});  


$sth=undef;
$dbh->disconnect; 



Philip




More information about the FreeTDS mailing list