Attribute Parameter Problem with bind_param( )

Discussion in 'Perl Misc' started by pnstarr@gmail.com, Sep 11, 2006.

  1. Guest

    Hi everybody,

    I've got a script that works perfectly when called from the command
    prompt. It collects data from online databases, processes it, and
    prints. I'm trying to use it in a web site, where the input is from an
    html form. But not all the data I want is printed into the newly
    created html page and the error log says that there is an attribute
    parameter problem in one of the methods called in the script.

    Here is the error from the error log:

    [error] [client 127.0.0.1] DBI::st=HASH(0x89628a4)->bind_param(...):
    attribute parameter '12' is not a hash ref at
    /home/pns7/src/ensembl/modules//Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
    246.

    Here is the SliceAdaptor.pm code line:

    246 $sth->bind_param(1, "$seq_region_name", SQL_VARCHAR);

    And bind_param( ) evidently has the following definitions according to
    O'Reilly's Programming the Perl DBI:
    bind_param($p_num, $bind_value)
    bind_param($p_num, $bind_value, \%attr)
    bind_param($p_num, $bind_value, $bind_type)

    SQL_VARCHAR does have the value '12' and is not a hash reference, but
    why does this matter since SQL_VARCHAR is a bind_type variable?
    Moreover, why does the method fail here but work when the script is run
    from the command prompt?

    Can somebody please help? Thanks,
    Peter
     
    , Sep 11, 2006
    #1
    1. Advertising

  2. Paul Lalli Guest

    wrote:
    > I've got a script that works perfectly when called from the command
    > prompt. It collects data from online databases, processes it, and
    > prints. I'm trying to use it in a web site, where the input is from an
    > html form. But not all the data I want is printed into the newly
    > created html page and the error log says that there is an attribute
    > parameter problem in one of the methods called in the script.
    >
    > Here is the error from the error log:
    >
    > [error] [client 127.0.0.1] DBI::st=HASH(0x89628a4)->bind_param(...):
    > attribute parameter '12' is not a hash ref at
    > /home/pns7/src/ensembl/modules//Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
    > 246.
    >
    > Here is the SliceAdaptor.pm code line:
    >
    > 246 $sth->bind_param(1, "$seq_region_name", SQL_VARCHAR);


    Please read:
    perldoc -q quoting


    > And bind_param( ) evidently has the following definitions according to
    > O'Reilly's Programming the Perl DBI:
    > bind_param($p_num, $bind_value)
    > bind_param($p_num, $bind_value, \%attr)
    > bind_param($p_num, $bind_value, $bind_type)
    >
    > SQL_VARCHAR does have the value '12' and is not a hash reference, but
    > why does this matter since SQL_VARCHAR is a bind_type variable?
    > Moreover, why does the method fail here but work when the script is run
    > from the command prompt?


    How confident are you that your command-line and web environments are
    identical? Try printing the value of $DBI::VERSION in your script, and
    seeing if you get the same results in both environments. Then try
    $DBD::Foo::VERSION (where 'Foo' is your driver module).

    Out of curiousity, why are you providing that value to bind_param in
    the first place? What benefit is it giving you?

    Paul Lalli
     
    Paul Lalli, Sep 11, 2006
    #2
    1. Advertising

  3. Guest

    wrote:
    > Hi everybody,
    >
    > I've got a script that works perfectly when called from the command
    > prompt. It collects data from online databases, processes it, and
    > prints. I'm trying to use it in a web site, where the input is from an
    > html form. But not all the data I want is printed into the newly
    > created html page and the error log says that there is an attribute
    > parameter problem in one of the methods called in the script.
    >
    > Here is the error from the error log:
    >
    > [error] [client 127.0.0.1] DBI::st=HASH(0x89628a4)->bind_param(...):
    > attribute parameter '12' is not a hash ref at
    > /home/pns7/src/ensembl/modules//Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
    > 246.
    >
    > Here is the SliceAdaptor.pm code line:
    >
    > 246 $sth->bind_param(1, "$seq_region_name", SQL_VARCHAR);
    >
    > And bind_param( ) evidently has the following definitions according to
    > O'Reilly's Programming the Perl DBI:
    > bind_param($p_num, $bind_value)
    > bind_param($p_num, $bind_value, \%attr)
    > bind_param($p_num, $bind_value, $bind_type)
    >
    > SQL_VARCHAR does have the value '12' and is not a hash reference, but
    > why does this matter since SQL_VARCHAR is a bind_type variable?


    What version of DBI are you using? Which DBD are you using? What version?

    > Moreover, why does the method fail here but work when the script is run
    > from the command prompt?


    Are you using the same versions of everything (Perl, DBI, DBD) between
    the two situations?

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Sep 11, 2006
    #3
  4. John Bokma Guest

    John Bokma, Sep 11, 2006
    #4
  5. Guest

    Much thanks. I'm using the same DBI version on both, 1.52. However, I
    get an error when trying to print $DBD::Foo::VERSION. The error is "a
    use of unitialized value in concatenation (.) or string. I've tried to
    locate DBD::Foo in my directories and I can't. So I'm going to see if
    I need to install the DBD::MySQL module. But I don't think I should
    need to do that since the script already works when run from command
    prompt.


    Paul Lalli wrote:
    > wrote:
    > > I've got a script that works perfectly when called from the command
    > > prompt. It collects data from online databases, processes it, and
    > > prints. I'm trying to use it in a web site, where the input is from an
    > > html form. But not all the data I want is printed into the newly
    > > created html page and the error log says that there is an attribute
    > > parameter problem in one of the methods called in the script.
    > >
    > > Here is the error from the error log:
    > >
    > > [error] [client 127.0.0.1] DBI::st=HASH(0x89628a4)->bind_param(...):
    > > attribute parameter '12' is not a hash ref at
    > > /home/pns7/src/ensembl/modules//Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
    > > 246.
    > >
    > > Here is the SliceAdaptor.pm code line:
    > >
    > > 246 $sth->bind_param(1, "$seq_region_name", SQL_VARCHAR);

    >
    > Please read:
    > perldoc -q quoting
    >
    >
    > > And bind_param( ) evidently has the following definitions according to
    > > O'Reilly's Programming the Perl DBI:
    > > bind_param($p_num, $bind_value)
    > > bind_param($p_num, $bind_value, \%attr)
    > > bind_param($p_num, $bind_value, $bind_type)
    > >
    > > SQL_VARCHAR does have the value '12' and is not a hash reference, but
    > > why does this matter since SQL_VARCHAR is a bind_type variable?
    > > Moreover, why does the method fail here but work when the script is run
    > > from the command prompt?

    >
    > How confident are you that your command-line and web environments are
    > identical? Try printing the value of $DBI::VERSION in your script, and
    > seeing if you get the same results in both environments. Then try
    > $DBD::Foo::VERSION (where 'Foo' is your driver module).
    >
    > Out of curiousity, why are you providing that value to bind_param in
    > the first place? What benefit is it giving you?
    >
    > Paul Lalli
     
    , Sep 11, 2006
    #5
  6. Guest

    Well, the bind_param( ) is being used in some BioPerl module. I didn't
    write the code. I did try, however, to delete the data type variable,
    but I got an even more inscrutable error message.


    John Bokma wrote:
    > "Paul Lalli" <> wrote:
    >
    > > Out of curiousity, why are you providing that value to bind_param in
    > > the first place? What benefit is it giving you?

    >
    > Not sure if it holds here, but see:
    > http://johnbokma.com/mexit/2006/03/12/index-exceeds-900-bytes.html
    >
    > --
    > John Experienced Perl programmer: http://castleamber.com/
    >
    > Perl help, tutorials, and examples: http://johnbokma.com/perl/
     
    , Sep 11, 2006
    #6
  7. [ Please stop top-posting! ]


    <> wrote:
    > Much thanks. I'm using the same DBI version on both, 1.52. However, I
    > get an error when trying to print $DBD::Foo::VERSION.



    > Paul Lalli wrote:



    >> Then try
    >> $DBD::Foo::VERSION (where 'Foo' is your driver module).

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Sep 11, 2006
    #7
    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. Bostonasian
    Replies:
    1
    Views:
    822
    Joris Gillis
    Sep 18, 2005
  2. Aray
    Replies:
    0
    Views:
    555
  3. Carlos Diaz

    ruby9i bind_param errors

    Carlos Diaz, Oct 9, 2005, in forum: Ruby
    Replies:
    2
    Views:
    114
    Carlos Diaz
    Oct 9, 2005
  4. David Lee
    Replies:
    0
    Views:
    100
    David Lee
    Oct 10, 2007
  5. B. Randy
    Replies:
    5
    Views:
    203
    B. Randy
    Apr 21, 2009
Loading...

Share This Page