In my work application, I use a mini language to express updates to the database schema, and I have code to parse that out and execute the necessary SQL. Here's a part of the update we used when we were moving to referencing users by id instead of by handle:
desc: category mod/ed referenced by id table: change moderator moderator_handle varchar(32), + change editor editor_handle varchar(32) table: add moderator int(11) unsigned not null, + add editor int(11) unsigned not null [loop: (uid, uhandle) select distinct u.id, u.handle + from users u, category c + where u.handle = c.moderator_handle or u.handle = c.editor_handl +e pop: update category set moderator = *uid where moderator_handle = + *uhandle pop: update category set editor = *uid where editor_handle = *uhan +dle ] table: drop moderator_handle, drop editor_handle
The code doing this is complex and intimately tied up with a lot of other stuff, so I'm not going to try to post it here. But I see no reason why you couldn't do something similar to parse the stored procedures and execute them directly - it'll take some pain to get the code working, but once you've done that you'll have the benefit that you only need to develop and maintain one version of each stored procedure.
Hugo
In reply to Re: Recoding a multi-sql-statement storedProc transaction in a script
by hv
in thread Recoding a multi-sql-statement storedProc transaction in a script
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |