Originally posted by Scott Selikoff: it doesn't make much difference whether I use a procedure call or not, just what runs the best.
I don't know about MySQL but usually stored functions are already compiled and therefore perform better than the equivalent dynamic code. And regardless whether its generated, I think that a stored function version would be more readable and observes the DRY principle better. Furthermore it allows you to update your encoding/decoding strategy with a mere update in the database while leaving the generating code untouched.
Thanks Peer, you're probably right about precompiling stored procedures, so should generate a function as part of the database install. As for readibility/management.... most triggers (especially these) are write once read never type stuff... you could never just modify these sucker
Originally posted by Scott Selikoff: As for readibility/management.... most triggers (especially these) are write once read never type stuff... you could never just modify these sucker
Well, triggers are different beasts from stored procedures and functions and aren't necessarily pre-compiled either. However I'm still inclined to move whatever functionality I can from a trigger into a stored procedure or function whenever I can.
I don't inherently favor or be against stored procedures/functions. In this case, the SQL is already in the database layer (a trigger.) So it makes sense to me to go all the way in and put it in a stored function.