Print Story ask husi: perl mysql stored procs?
My dear HuSi infidels, the time has come yet again for me to beg for your mercy.  Have any of you had to bear the burden the pleasure of hacking in Perl on MySQL's stored procedures?  Because I'm frigging stumped!


You take your very simple stored proc:

<pre>CREATE PROCEDURE test()
BEGIN
  SELECT 1;
END</pre>

It seems to me that using the Perl DBI you are utterly unable to call this stored procedure using either $dbh->do or $sth->prepare/execute.  I can call it from the cli just fine, as with python and php.  But it can't be totally impossible with Perl can it?  Something so basic to be impossible?

Yes, I know I could/should create an output variable and assign a value to it.  Except that is out of bounds for reasons I'm not going to go into.


Oh, and is anyone else glad that with the Democrats owning USian congress we've now got a new bogeyman to bitch at when the US gov't does stupid things?  Even I was getting sick of ragging on Republicans all the time!  Okay I wasn't, but still it's a nice change of pace.

< some books and games and such | BBC White season: 'Rivers of Blood' >
ask husi: perl mysql stored procs? | 7 comments (7 topical, 0 hidden) | Trackback
This database thing is just a fad by ShadowNode (2.00 / 0) #1 Tue Nov 21, 2006 at 09:42:43 PM EST
You should write it as a flat file in plain c, or the ter'ists republicans win.

Thread by anonimouse (2.00 / 0) #2 Wed Nov 22, 2006 at 01:12:51 AM EST
Does this thread on the MySQL forums help at all?

Girls come and go but a mortgage is for 25 years -- JtL
heh by theantix (2.00 / 0) #3 Wed Nov 22, 2006 at 07:40:57 AM EST
Thanks, however that was the first place I found too.  The DBD version I'm using is greater than what they say in that thread is required for it to work, except it still doesn't.
____________________________________
I'm sorry, but your facts disagree with my opinion.
[ Parent ]
I must be the only person on earth who likes perl. by mrgoat (4.00 / 1) #4 Wed Nov 22, 2006 at 08:53:37 AM EST
Why yous gotta rag on perl? It's dense, arcane, filled with random syntax, and never really seems to be totally consistent. What's not to like? I say, any language that requires semicolons, whitespace, carriage returns/newlines, has strict typing, etc. is no friend of mine. I want the next guy down the line confused, and I mean it.

Actually, I'm just rather fond of pcre's. That said, I don't know how to solve your problem. Did you try calling ${$@[rand0..5].${&{$()}}->(); yet? That might work.

--top hat--

Addendum: by mrgoat (4.00 / 4) #5 Wed Nov 22, 2006 at 08:58:50 AM EST
I meant $_{$@_[rand0..5].${\&{$_()}}->(); Apologies. Note: code probably doesn't work. Then again, I once peed on a keyboard and perl managed to run it.

--top hat--
[ Parent ]
my main honest complaint about perl by theantix (4.00 / 1) #6 Wed Nov 22, 2006 at 10:42:45 AM EST
It's popular enough that you find it around in a lot of places, except not popular enough to handle edge cases.  Apparently so few people actually use MySQL stored procedures with Perl that hardly anyone has even noticed this problem I ran into.  Same with scoop's problem with Perl and apache2.

There are of course lots and lots of reasons to rag on perl, but most of them are dishonest and you can get around them with good coding practices. 
____________________________________
I'm sorry, but your facts disagree with my opinion.

[ Parent ]
I agree on both counts. by mrgoat (2.00 / 0) #7 Sun Nov 26, 2006 at 05:54:08 PM EST
It seems that many perl coders have the opinion that "good coding practices are for wusses", and that makes me sad. I still appreciate the ability to write some quick, throwaway code when I need it. I guess the trick is knowing when it's really just one-use code.

--top hat--
[ Parent ]
ask husi: perl mysql stored procs? | 7 comments (7 topical, 0 hidden) | Trackback