in reply to DBI execute() args in array format (or similar) possible?

If you're going to build up bind parameter values by pushing them onto an array, you have to be extra careful to push the right number. Your query has 4 bind markers. You must supply 4 values. If there are 4 values in the array, DBI won't complain that it's seeing one.

Check the size of @args. I'll bet you have an upstream problem with command-line argument processing.

  • Comment on Re: DBI execute() args in array format (or similar) possible?

Replies are listed 'Best First'.
Re: Re: DBI execute() args in array format (or similar) possible?
by snafu (Chaplain) on Aug 12, 2002 at 20:19 UTC
    This is correct. In fact, the size of args is the right number of elements. Look at the output I placed. @args has 4 elements which are suppose to be the elements I am trying to send to execute(). However, it was pointed out to me (and of course this was just an oversight of mine) that execute sees only one bind...the array. Of course, like I said, I tried to trick execute with a join(',',@args) but that didn't work For the record, I did try the join() before trying to send the array by itself since it made sense to me that execute() needed separate args. I just tried sending the list by itself as a measure of troubleshooting, just in case.

    I am ultimately going to have to find a different way to pass these statements to DBI. I am reading the article suggested by aufrank and taking screamingeagle's advice on some things as well.

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

      Look at the output I placed. @args has 4 elements which are suppose to be the elements I am trying to send to execute().

      Are you sure? The only diagnostic I see is printing "@args\n", which stringifies the array, making it impossible to tell whether you have 4 elements or 1. That's why I suggested that you check the array size.

      For the record, I did try the join() before trying to send the array by itself since it made sense to me that execute() needed separate args.

      Are you sure there aren't lingering traces of this join() in some other place in the code? Lingering traces of prior code experiments are a frequent source of bugs (mine, at least).