[freetds] freetds-0.63: Problem with DBD::ODBC

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Jan 10 03:02:17 EST 2006


> 
> Hi all.
> 
> I've just noticed that some code that was working under 
> freetds-0.62.4 
> is no longer working under freetds-0.63.
> 
> I'm using:
> 
> Perl 5.8.7
> DBD::ODBC-1.13
> 
> The code that is failing is a simple prepare statement, in the form:
> 
> ---
> 
> eval {
>    my $sth = $dbh->prepare( "insert into SomeTable ( Field_1, 
> Field_2, 
> Field_3 ) values ( ?, ?, ? )
>       || die $dbh->errstr;
> };
> 
> if ( $@ ) {
>    print "Couldn't prepare statement ... DB server said: $@\n";
>    # more error handling code
> }
> 

We are releasing 0.64.

my $sth;
eval {
   $sth = $dbh->prepare( "insert into SomeTable ( Field_1, Field_2,
Field_3 ) values ( ?, ?, ? )") || die $dbh->errstr;
};

if ( $@ ) {
   print "Couldn't prepare statement ... DB server said: $@\n";
   # more error handling code
}

# Execute the SQL and print the (possibly several) results
$rc = $sth->execute(1,'xxx','ciao');
print STDERR qq(execute returned: '$rc'\n) if $rc;

$i = 1;
while ( $sth->{Active} ) {
        printf "Result #%d:\n", $i++;
        my @names = @{$sth->{NAME}};    # print column names for each
result set
        print '[', join("], [", @{$sth->{NAME}}), "]\n" if @names;
        while(@dat = $sth->fetchrow) {
                print q('), join(q(', '), @dat), qq('\n);
        }
}

Without "SomeTable" table

DBD::ODBC::st execute failed: [unixODBC][FreeTDS][SQL Server]Invalid
object name 'SomeTable'. (SQL-42S02)(DBD: st_execute/SQLExecute err=-1)
at ./samples/mao.pl line 76.

(correct)

With "SomeTable" table

execute returned: '1'

And row inserted correctly

freddy77


More information about the FreeTDS mailing list