perl mysql procedures

Discussion in 'Perl Misc' started by Shiraz, Jan 6, 2006.

  1. Shiraz

    Shiraz Guest

    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; }
     
    Shiraz, Jan 6, 2006
    #1
    1. Advertising

  2. Shiraz

    Mihail Guest

    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;}
     
    Mihail, Jan 6, 2006
    #2
    1. Advertising

  3. Shiraz

    Paul Lalli Guest

    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
     
    Paul Lalli, Jan 6, 2006
    #3
  4. Shiraz

    Paul Lalli Guest

    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
     
    Paul Lalli, Jan 6, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JL
    Replies:
    0
    Views:
    1,179
  2. Ravi
    Replies:
    6
    Views:
    1,447
    Suchandra Thapa
    Jul 21, 2003
  3. Replies:
    2
    Views:
    6,255
  4. washakie
    Replies:
    4
    Views:
    958
    washakie
    Jan 15, 2008
  5. Shiraz
    Replies:
    14
    Views:
    258
    Shiraz
    Jan 9, 2006
Loading...

Share This Page