DBD::Sybase - Sybase stored procedure invocation with place holders
am 07.11.2007 13:56:10 von Rafiq.Ismail
This feels like a silly question. Anyone ever have trouble with
DBD::Sybase, when using placeholders in prepared statement handles to a
stored procedure exec?
=20
On $sth->execute, I keep getting warnings for each stored procedure
parameter, stating that it hasn't been provided. =20
=20
I tried to explicitly bind these by TYPE=3D>DBI::SQL_s. No =
change.
=20
However, when I forsake reusing the $sth and hard code in my parameter
values, everything works great. I tried to do this without affecting
the original message using $sql2 =3D~ s{(?
statements
( we pass =3D '?' as hard coded literals in places ). Is there an issue
with the bind? I tried both bind_param and execute($arg1,..., $argn) -
both seem to fail. Could the problem be related to the fact that this
stored procedure has quite a large signature (>100 parameters)?
=20
This only seems to be a problem when executing stored procedures and not
in other update/insert contexts.
=20
Familiar? Any ideas?
=20
Thanks,
Raf
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender =
does not intend to waive confidentiality or privilege. Use of this email =
is prohibited when received in error.
Re: DBD::Sybase - Sybase stored procedure invocation with place holders
am 07.11.2007 14:26:06 von Hildo.Biersma
Ismail, Rafiq (IT) wrote:
> This feels like a silly question. Anyone ever have trouble with
> DBD::Sybase, when using placeholders in prepared statement handles to a
> stored procedure exec?
>
> On $sth->execute, I keep getting warnings for each stored procedure
> parameter, stating that it hasn't been provided.
>
> I tried to explicitly bind these by TYPE=>DBI::SQL_s. No change.
>
>
> However, when I forsake reusing the $sth and hard code in my parameter
> values, everything works great. I tried to do this without affecting
> the original message using $sql2 =~ s{(?
> ( we pass = '?' as hard coded literals in places ). Is there an issue
> with the bind? I tried both bind_param and execute($arg1,..., $argn) -
> both seem to fail. Could the problem be related to the fact that this
> stored procedure has quite a large signature (>100 parameters)?
>
> This only seems to be a problem when executing stored procedures and not
> in other update/insert contexts.
>
> Familiar? Any ideas?
Have you read the DBD::Sybase documentation?
RE: DBD::Sybase - Sybase stored procedure invocation with place holders
am 07.11.2007 14:38:27 von Rafiq.Ismail
Yes. It's ambiguous:
i) You can only use ?-style placeholders for statements that return a
single result set, and the ? placeholders can only appear in a WHERE
clause, in the SET clause of an UPDATE statement, or in the VALUES list
of an INSERT statement.
ii) DBD::Sybase has the ability to use ?-style placeholders as
parameters to stored proc calls. The requirements are that the stored
procedure call be initiated with an "exec" and that it be the only
statement in the batch that is being prepared():
However, I clearly needed prompting to read it again. =20
For the benefit of those searching the archives and haven't read the
fine man page:
"You can't mix placeholder parameters and hard coded parameters."
My own statement was of the same form as:
$sth =3D $dbh->prepare("exec my_proc \@p1 =3D 1, \@p2 =3D ?");
According to the docs, this 'will not work - because the @p1 parameter
isn't parsed correctly and won't be sent to the server.'
R.
> -----Original Message-----
> From: Biersma, Hildo (IT)=20
> Sent: 07 November 2007 13:26
> To: Ismail, Rafiq (IT)
> Cc: dbi-users@perl.org
> Subject: Re: DBD::Sybase - Sybase stored procedure invocation=20
> with place holders
>=20
> Ismail, Rafiq (IT) wrote:
> > This feels like a silly question. Anyone ever have trouble with=20
> > DBD::Sybase, when using placeholders in prepared statement=20
> handles to=20
> > a stored procedure exec?
> > =20
> > On $sth->execute, I keep getting warnings for each stored procedure=20
> > parameter, stating that it hasn't been provided.
> > =20
> > I tried to explicitly bind these by TYPE=3D>DBI::SQL_s.=20
> No change.
> >=20
> > =20
> > However, when I forsake reusing the $sth and hard code in=20
> my parameter=20
> > values, everything works great. I tried to do this without=20
> affecting=20
> > the original message using $sql2 =3D~ s{(?
> > statements ( we pass =3D '?' as hard coded literals in places ). Is =
> > there an issue with the bind? I tried both bind_param and=20
> > execute($arg1,..., $argn) - both seem to fail. Could the=20
> problem be=20
> > related to the fact that this stored procedure has quite a=20
> large signature (>100 parameters)?
> > =20
> > This only seems to be a problem when executing stored=20
> procedures and=20
> > not in other update/insert contexts.
> > =20
> > Familiar? Any ideas?
>=20
> Have you read the DBD::Sybase documentation?
>
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender =
does not intend to waive confidentiality or privilege. Use of this email =
is prohibited when received in error.