Loading ...
Sorry, an error occurred while loading the content.

accessing hash in object

Expand Messages
  • Ashley Clark
    Hmm, I m banging my head against a wall here. in my constructor I ve got somthing like this: $self- {_qfields} = { code = 1, name = 1, active = 1, }; then
    Message 1 of 4 , May 9, 2001
    • 0 Attachment
      Hmm, I'm banging my head against a wall here.

      in my constructor I've got somthing like this:

      $self->{_qfields} = {
      code => 1,
      name => 1,
      active => 1,
      };

      then when I try to access it in another procedure later using:

      my $ary_ref = $q->fetchall_arrayref(%{$self->{_qfields}});

      I get this error from the server:

      DBI fetchall_arrayref: invalid number of parameters: handle + 6

      I can't figure out what the problem is, can someone help?

      --
      hacker sally
    • Garrett Goebel
      From: Ashley Clark [mailto:aclark@ghoti.org] ... Sounds like a problem for the DBI mailing list... What do you get in $ary_ref if you do: my $ary_ref =
      Message 2 of 4 , May 9, 2001
      • 0 Attachment
        RE: [soaplite] accessing hash in object

        From: Ashley Clark [mailto:aclark@...]
        >
        > Hmm, I'm banging my head against a wall here.
        >
        > in my constructor I've got somthing like this:
        >
        > $self->{_qfields} = {
        >       code => 1,
        >       name => 1,
        >       active => 1,
        > };
        >
        > then when I try to access it in another procedure later using:
        >
        > my $ary_ref = $q->fetchall_arrayref(%{$self->{_qfields}});
        >
        > I get this error from the server:
        >
        > DBI fetchall_arrayref: invalid number of parameters: handle + 6

        Sounds like a problem for the DBI mailing list...

        What do you get in $ary_ref if you do:

        my $ary_ref = $q->fetchall_arrayref();

        Sounds like your asking for more fields than there are... Then again, I'm not current on how the paramaters passed to fetchall_arrayref and fetchall_hashref work.

        Garrett

      • Ashley Clark
        * Garrett Goebel in Re: accessing hash in object dated 2001/05/09 ... No, if I pass the hash anonymously it works, the error happens if I create the hash in
        Message 3 of 4 , May 9, 2001
        • 0 Attachment
          * Garrett Goebel in "Re: accessing hash in object" dated 2001/05/09
          * 15:41 wrote:

          > > $self->{_qfields} = {
          > > code => 1,
          > > name => 1,
          > > active => 1,
          > > };
          > >
          > > then when I try to access it in another procedure later using:
          > >
          > > my $ary_ref = $q->fetchall_arrayref(%{$self->{_qfields}});
          > >
          > > I get this error from the server:
          > >
          > > DBI fetchall_arrayref: invalid number of parameters: handle + 6
          >
          > Sounds like a problem for the DBI mailing list...
          ...
          > Sounds like your asking for more fields than there are... Then again,
          > I'm not current on how the paramaters passed to fetchall_arrayref and
          > fetchall_hashref work.

          No, if I pass the hash anonymously it works, the error happens if I
          create the hash in one procedure, return a SOAP object, then call
          another method to reference the hash. Curiously if I just use
          $q->fetchall_arrayref($self->{_qfields}); it craps out saying
          fetchall_arrayref(SOAPStruct) invalid.

          --
          chalk slayer
        • Paul Kulchenko
          Hi, Ashley! ... Glad to know it works. Yes, It should work with Perl 5.005 and even 5.004. I don t plan to abandon those versions and even I plan to introduce
          Message 4 of 4 , May 9, 2001
          • 0 Attachment
            Hi, Ashley!

            --- Ashley Clark <aclark@...> wrote:
            > > I think I know the reason. versions before 0.50 actually blessed
            > > usual hashes into SOAPStruct (it doesn't matter for hash-handling
            > > code, but it seems like for some reason it matters for DBI). If
            > it's
            > > really the case, you may either upgrade to 0.50 or instead of
            > using
            > >
            > > > my $ary_ref = $q->fetchall_arrayref($self->{_qfields});
            > >
            > > debless it to usual hash:
            > >
            > > my $ary_ref = $q->fetchall_arrayref({%{$self->{_qfields}}});
            >
            > Works wonderfully, I've been meaning to move up to .5 but I've been
            > putting it off. Will it still work with perl 5.005? I think I
            > remember reading that the new XML code only worked in 5.6.
            Glad to know it works. Yes, It should work with Perl 5.005 and even
            5.004. I don't plan to abandon those versions and even I plan to
            introduce perl5.6 only features (like attributes), but it's more like
            syntax sugar and you will be able to do it with SOAP::Data in all
            supported Perl versions.

            Best wishes, Paul.

            __________________________________________________
            Do You Yahoo!?
            Yahoo! Auctions - buy the things you want at great prices
            http://auctions.yahoo.com/
          Your message has been successfully submitted and would be delivered to recipients shortly.