develooper Front page | perl.dbi.users | Postings from February 2008

Re: Strange results returned using Linux to MS SQL 2005 through Sybaseand FreeTDS

Thread Previous
From:
Michael Peppler
Date:
February 23, 2008 23:24
Subject:
Re: Strange results returned using Linux to MS SQL 2005 through Sybaseand FreeTDS
Thomas Möller wrote:
> Hi all,
> 
> I'm new to the usage of the FreeTDS and DBD::Sybase combination.
> I am seemingly able to connect to the DB correctly. It may perhaps
> be as simple as my MSSQL syntax is failing? I have verified that
> I am at all able to communicate correctly with the database by
> using the tool "tsql" which work like a charm giving me the
> expected results.
> 
> However, when executing the classical test PERL script to fetch
> the server version:


> 
> if($sth->execute) {
>         @dat = $sth-fetchrow;
>         print "@dat\n";
> }

If that's the actual script you ran then the error is in the fetchrow() 
call above. You do
      $sth-fetchrow;
instead of
      $sth->fetchrow;

As you don't have "use strict", nor warnings, perl lets you do this 
without complaining. In this case it interprets "fetchrow" as a string, 
which evaluates to 0 in a numerical context ($sth - 0), which returns a 
number.

Michael
-- 
Michael Peppler           -                 Peppler Consulting SaRL
mpeppler@peppler.org      -                  http://www.peppler.org
Sybase DBA/Developer      -   TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ       -   http://www.peppler.org/FAQ/linux.html

Thread Previous


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About