Has anyone seen a tool for MYSql that generates stored procedures based on the database? Have not used MySQL that much and have found these tools to be helpful in generating the 'start' of stored procedures. I have a new applications that will have quite a few tables that will require this.
I have written a script in PHP which basically does what Crud does. It creates 4 stored procedures based on the primary key of the table in a database. If no primary key exists no stored procedures are created. The 4 stored procedures per table include one that perform a select on the entire table, another which selects using the primary key, another one which deletes based on the primary key and the last one which either updates or insert depending on whether the primary key exists.
Thanks for the input and I have downloaded the script. Now I just gotta figure out how to execute it. I am running a VM with TurnKeyLinux with the LAMP stack. I can access PHPMyAdmin, and other things but have no idea where to start.
basically it is a PHP script so this can be run from the command line using:
php phpCrud.php -u <username> -d <database>
There are additional parameters such as hostname, password and individual table.
It is not exactly a CRUD where it generates the CREATE table but reverse engineers the stored procedures based on the already existing tables in the database. I identify the primary key of the table and then make sure that access to the data is unique.
I have also created a mini screencast and have added this to the webpage where you can download the script.