Skip to Content.
Sympa Menu

freetds - Re: [freetds] DBD::Sybase placeholder support

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Dan Wierenga" <dwierenga AT valueclick.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] DBD::Sybase placeholder support
  • Date: Thu, 8 May 2008 15:20:42 -0700



> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org [mailto:freetds-
> bounces AT lists.ibiblio.org] On Behalf Of James K. Lowden
> Sent: Wednesday, May 07, 2008 7:08 PM
> To: TDS Development Group
> Subject: [freetds] DBD::Sybase placeholder support
>
> I was provided with an interesting rumor today: it seems placeholders
> *do*
> work in DBD::Sybase! I haven't been able to test it yet, but perhaps
> someone out there would?

Wow... I'm amazed, but I can confirm it works. I tested basic SELECT,
INSERT, UPDATE, and DELETE statements with placeholders and they seem to
work fine. One thing I did note was that if I call a stored procedure
with EXEC and placeholders, it didn't seem to work. It did, however,
without the EXEC statement. Example:

With proc_dantest created as "create proc proc_dantest (@foo int) as
begin select @foo end"

my $sth = $dbh->prepare(q|EXEC proc_dantest ? |);
$sth->execute(10000);
print $sth->fetchrow_array;

produces no output nor error message. However,

my $sth = $dbh->prepare(q|proc_dantest ? |);
$sth->execute(10000);
print $sth->fetchrow_array

produces the expected output of 10000.

Using EXEC with a stored proc that doesn't take parameters works as
expected.

I tested with perl 5.8.8, DBI 1.52, DBD::Sybase 1.105, FreeTDS 0.64, and
Sql Server 2000 and 2005.

Something I'm curious about though... HOW does this work? Is it because
Microsoft has suddenly developed support for server-side placeholders?
I checked the $dbh->{syb_dynamic_supported} attribute, which reports
true against my servers. Unfortunately I can't say I ever checked that
value against any older versions of Sql Server so I've no idea if it's
suddenly "new and improved".

-dw

> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page