Jorge Albaladejo

Hard & Soft design…

Archive for the ‘stored procedures’ tag

Creating Triggers in MySQL from PHP

without comments

On my last project, I needed to create tables periodically on a database, to partition data in several identical tables, named according to the year quarter. Instead of using MySQL 5.1 automatic partition, I preferred doing it in a more manual way, to allow accessing individual partitions if suitable to speed up queries.

So I wrote a php script that would run with a cron job and every three months, create a new table, add it some triggers, and remap a MyISAM merged table on another database. Clear and easy, at the beginning. Everything went right until I went for the triggers creation…

Read the rest of this entry »

Written by Jorge Albaladejo

February 25th, 2009 at 2:01 pm

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 6020 items have been purified.