Re: DBD::Sybase placeholder support

"Dan Wierenga" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <24CF2B9B9D2BCC4B8F6EA9528B63C8360A20A363@LA-EXCLUST01.corp.valueclick.com>

> -----Original Message-----
> From: [email protected] [mailto:freetds-
> [email protected]] 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
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.