in reply to Re^3: Updating database question
in thread Updating database question

I'll all for Class::DBI. Wouldn't the best solution be to add a handler to the class for that table:
__PACKAGE__->set_sql(query_name_here => qq{ UPDATE __TABLE__ SET col3 = ? WHERE LOWER( col4 ) LIKE CONCAT('%', ?, '%') };
I'm not sure if the CONCAT function would be necessary.

Replies are listed 'Best First'.
Re^5: Updating database question
by dragonchild (Archbishop) on Jun 30, 2005 at 21:03 UTC
    If you're doing the concatenation in SQL, then it's necessary. (Note, CONCAT() is MySQL-specific. Oracle, for example, would use the || operator.)

    Yes, it's possible and probably preferable to do it that way. However, I was demonstrating how CDBI makes simple-to-conceive-of tasks simple-to-do. It's the difference between Assembler (DBI) and Perl (CDBI).


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?