[freetds] FreeTDS --> DBD::ODBC - Errors not being raised

Daniel Kasak dkasak at nusconsulting.com.au
Tue Jan 31 22:24:47 EST 2006


Hi all.

I'm using FreeTDS-0.62.4 with DBD-ODBC-1.13 and unixODBC-2.2.11 to 
connect to SQL Server 7.

I just found something disturbing ...

I've got code that goes:

---

eval{
 $sth = $dbh->prepare( $sql ) || die $dbh->errstr;
}

if ( $@ ) {
  # complain
}

eval {
   $sth->execute || die $dbh->errstr;
}

while ( my @row = $sth->fetchrow_array ) {
   # stuff
}

---

The problem is that my $sql was bad, and I didn't get any warnings. The 
code ran straight through, and simply jumped over the fetchrow_array 
part as if there were no records. I copied $sql into SQL Server's query 
analyser, and it told me that there were 2 ambiguous column names in my 
query! So I fixed these by referring to the fields in table.field 
format, and now I get the expected results.

Is this a known issue? It's quite easy to reproduce on my system ...

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak at nusconsulting.com.au
website: http://www.nusconsulting.com.au


More information about the FreeTDS mailing list