[Dbix-class] multiple placeholders for the same column

John Napiorkowski jjn1056 at yahoo.com
Wed Jan 10 21:18:21 GMT 2007


Hi,

I'm trying to clean up the issues with the param_bind
branch, in particular the failing test that Matt
noticed for the ordered function.  Turns out the issue
has nothing to do with ordering really, just my code
can't handle SQL statements where a single column has
multiple params.

Here's the troublesome SQL statement:

UPDATE employee SET position = position - 1 WHERE (
position BETWEEN ? AND ? )

Usually my code expects a single bind parameter per
column name; I am looping through the parameters
returned by SQL::Abstract and setting the bind each
time.

However for any statement like the above instead of a
single value for the column I get one or more.  So to
solve this I loop through each data item and bind
separately.  After this change the tests all passed
but it's a big change.  Anyone out there know if what
I did sounds like the correct thing to do?  The source
code has been check into the branch, you can diff
against the previous to see what I did.  I'm running
some more tests to see if this is okay.

I didn't try to make a similar change to the bulk
insert function, to be honest I'm not sure about the
approach.  How big an issue would this be do you
think?  What would be the call for bulk inserts with
statements like the above?

I got a bit more refactoring on this and then I think
it's okay.  Oh, BTW I get a depreciation warning in my
test:

compose_connection deprecated as of 0.08000

What replaces it or is there a sample around I can use
to fix my test?  Since my tests are new there is no
excuse for me to leave it this way.

--john




 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index



More information about the Dbix-class mailing list