Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] freetds-0.63: Problem with DBD::ODBC
  • Date: Tue, 10 Jan 2006 09:02:17 +0100

>
> 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




Archive powered by MHonArc 2.6.24.

Top of Page