[freetds] DBD::Sybase placeholder support

Dan Wierenga dwierenga at valueclick.com
Thu May 8 18:20:42 EDT 2008



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



More information about the FreeTDS mailing list