Re: Every Statement is a prepared stored proc?

Michael Peppler <[email protected]> Thu, 9 Oct 2008 07:25:46 +0200
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <[email protected]>
--Apple-Mail-41-409610549
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

On Oct 8, 2008, at 11:52 PM, [email protected] wrote:

>
> How do we avoid this problem?
> Would using DBI{finish} cause this?
>
>
> create proc DBD17 as SELECT mycolumn AS mycolumn FROM my2ndtable  
> WHERE id = ?
> create proc DBD18 as UPDATE my2ndtable SET mycolumn = ? WHERE id = ?
> create proc DBD19 as SELECT mycolumn AS mycolumn FROM my2ndtable  
> WHERE id = ?
> create proc DBD20 as UPDATE my2ndtable SET mycolumn = ? WHERE id = ?
> create proc DBD21 as SELECT mycolumn AS mycolumn FROM my2ndtable  
> WHERE id = ?
> create proc DBD22 as UPDATE my2ndtable SET mycolumn = ? WHERE id = ?

The script is calling prepare() for the same statement multiple times.  
You could try using prepare_cached(), or modify your script to call  
the prepare() twice (once for each of the two statements), and then  
use the two statement handles to execute the calls.

Michael
--
Michael Peppler              -                    Peppler Consulting  
SaRL
[email protected]         -                     http://www.peppler.org
Sybase DBA/Developer         -      TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ          -      http://www.peppler.org/FAQ/linux.html




--Apple-Mail-41-409610549
Content-Type: text/html;
	charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><div><div>On Oct 8, 2008, at =
11:52 PM, <a =
href=3D"mailto:[email protected]">CSane@EvergreenInvestments.=
com</a> wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><br><font size=3D"2" face=3D"sans-serif">How do we avoid =
this problem?</font> <br><font size=3D"2" face=3D"sans-serif">Would =
using DBI{finish} cause this?</font> <br> <br> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD17 as SELECT mycolumn AS mycolumn =
FROM my2ndtable WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD18 as UPDATE my2ndtable SET mycolumn =
=3D ? WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD19 as SELECT mycolumn AS mycolumn =
FROM my2ndtable WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD20 as UPDATE my2ndtable SET mycolumn =
=3D ? WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD21 as SELECT mycolumn AS mycolumn =
FROM my2ndtable WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif">create proc DBD22 as UPDATE my2ndtable SET mycolumn =
=3D ? WHERE id =3D ?</font> <br><font size=3D"2" =
face=3D"sans-serif"></font></blockquote><div><br></div><div>The script =
is calling prepare() for the same statement multiple times. You could =
try using prepare_cached(), or modify your script to call the prepare() =
twice (once for each of the two statements), and then use the two =
statement handles to execute the =
calls.</div><div><br></div><div>Michael</div><div>--</div></div><div =
apple-content-edited=3D"true"> <span class=3D"Apple-style-span" =
style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><div><div>Michael Peppler &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;Peppler Consulting =
SaRL</div><div>[email protected] &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a =
href=3D"http://www.peppler.org">http://www.peppler.org</a></div><div>Sybas=
e DBA/Developer &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; &nbsp; =
&nbsp;TeamSybase: <a =
href=3D"http://www.teamsybase.com">http://www.teamsybase.com</a></div><div=
>Sybase on Linux FAQ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; =
&nbsp;<a =
href=3D"http://www.peppler.org/FAQ/linux.html">http://www.peppler.org/FAQ/=
linux.html</a></div><div><br></div></div></div></span><br =
class=3D"Apple-interchange-newline"> </div><br></body></html>=

--Apple-Mail-41-409610549--