Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl mysql procedures

Reply
Thread Tools

perl mysql procedures

 
 
Shiraz
Guest
Posts: n/a
 
      01-06-2006
I am trying to call procedures within perl that have a statement
"select 'result' ". i have confirmed that the function works in mysql
but errors out in perl.
I found a bug fix on CPAN (http://rt.cpan.org/NoAuth/Bug.html?id=12322)
but that is for DBD-mysql-2.9006 and i have DBD::mysql -- 2.9007. Can
anyone suggest what i should do?

My installation details:
perl, v5.8.0 built for i386-linux-thread-multi
DBD::mysql -- 2.9007
DBI -- 1.48

Script:
$SQL_Text = "call procedure()" ;
$sth=$dbh->prepare($SQL_Text);
$sth->execute();
while ( ($tt) = $sth->fetchrow_array( ) ) { print $tt; }

 
Reply With Quote
 
 
 
 
Mihail
Guest
Posts: n/a
 
      01-06-2006
Shiraz wrote:
> I am trying to call procedures within perl that have a statement
> "select 'result' ". i have confirmed that the function works in mysql
> but errors out in perl.
> I found a bug fix on CPAN (http://rt.cpan.org/NoAuth/Bug.html?id=12322)
> but that is for DBD-mysql-2.9006 and i have DBD::mysql -- 2.9007. Can
> anyone suggest what i should do?
>
> My installation details:
> perl, v5.8.0 built for i386-linux-thread-multi
> DBD::mysql -- 2.9007
> DBI -- 1.48
>
> Script:
> $SQL_Text = "call procedure()" ;
> $sth=$dbh->prepare($SQL_Text);
> $sth->execute();
> while ( ($tt) = $sth->fetchrow_array( ) ) { print $tt; }
>


May be:

---
while (@tt = $sth->fetchrow_array( ) ) { print @tt; }
---
while ($tt = $sth->fetchrow_arrayref( ) ) { print @$tt;}
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      01-06-2006
Shiraz wrote:
> I am trying to call procedures within perl that have a statement
> "select 'result' ". i have confirmed that the function works in mysql
> but errors out in perl.


"errors out" is not helpful. What is the error message? Copy and
paste the exact error message you receive. With what you said, I don't
even know if you're getting a Perl error or a MySQL error.

Have you read the Posting Guidelines for this group?

> I found a bug fix on CPAN (http://rt.cpan.org/NoAuth/Bug.html?id=12322)
> but that is for DBD-mysql-2.9006 and i have DBD::mysql -- 2.9007. Can
> anyone suggest what i should do?


No, because you haven't told us what's going wrong.

> My installation details:
> perl, v5.8.0 built for i386-linux-thread-multi
> DBD::mysql -- 2.9007
> DBI -- 1.48
>
> Script:
> $SQL_Text = "call procedure()" ;
> $sth=$dbh->prepare($SQL_Text);
> $sth->execute();
> while ( ($tt) = $sth->fetchrow_array( ) ) { print $tt; }


Do you have RaiseError turned on? If not, you should be checking those
prepare() and execute() statements for errors.

Paul Lalli

 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      01-06-2006
Mihail wrote:
> Shiraz wrote:
> > I am trying to call procedures within perl that have a statement
> > "select 'result' ".

<snip>
> > while ( ($tt) = $sth->fetchrow_array( ) ) { print $tt; }
> >

>
> May be:
>
> ---
> while (@tt = $sth->fetchrow_array( ) ) { print @tt; }
> ---
> while ($tt = $sth->fetchrow_arrayref( ) ) { print @$tt;}


What problem do you think that would solve? The OP is selecting one
column, and calling fetchrow_array() in a list context, assigning to a
one-element list. Your two alternatives are simply two other
statements that will do the same thing as the OP's code.

Paul Lalli

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL-python-1.2.2 install with no mysql washakie Python 4 01-15-2008 08:15 PM
calling mysql stored procedures / functions Shiraz Perl Misc 14 01-09-2006 03:36 AM
"mysql.h: No such file or directory" when building MySQL-python francescomoi@europe.com Python 2 05-11-2005 03:12 PM
DBD:mysql doesn't read mysql option file /etc/my.cnf file JL Perl 0 01-28-2005 03:19 AM
"Pure Python" MySQL module like Net::MySQL Ravi Python 6 07-21-2003 06:53 PM



Advertisments