Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: DBD::Sybase stored proc parameter binding doesn't work to
bindjust some parameters
Date: Jun 11 2004 3:17PM
On Fri, 2004-06-11 at 17:12, Avis, Ed wrote:
> Michael Peppler wrote:
> >> my $sth = $dbh->prepare('exec foo @a = 1, @b = ?');
> >This won't work - because the (very simplistic) parser that checks to
> >see what sort of parameters are passed doesn't see the first
> >parameter (@a), and so only sends the second parameter.
> I can't find the prepare() code but I thought that it would work by
> string substitution, replacing each ? with an (appropriately quoted)
> value. Or by creating a temporary stored proc as mentioned in the
> docs, again just brute-force replacing ? with parameter names.
It's in dbdimp.c - look in dbd_preparse().
The parser is very simplistic - if it sees the string start with "exec"
and if it includes ? placeholders then it assumes that the first thing
is the procedure name, and then parses the rest rather primitively.
Michael Peppler Data Migrations, Inc.
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html