The Time Draws near for Stored Procs...across the board
Ok, i'll be the one to call the pink elephant in the room.....stored procedures do exisit. There I said it. :). With MySQL 5 starting to support them, Postgres has had them, and the push latley to start using a wider array and more robust DB's (oracle, mssql, DB2), it is time I think to start thinking about a database abstraction layer to handel stored procedures. I'm thinking perhaps something like this:
/**
* @param $proc_name Name of the stored proc.
* @param $args Argements to send to the proc indexed by the variables name. e.g. array('name' => 'Jim Smith');
* @return $rs array Array consisting of 'status' (status of the proc run), and 'return' with either an array of result sources, the result item, or just 1 result source.
*/
$rs = db_call_proc($proc_name, $args) {
//....implement
}Just a thought.
This could greatly improve performance on some large systems. SP's are great for off loading heavy duty stuff to the DB. Example, duing a cron, the search_cron could just call an SP that it installed on db of type 'x' during it's installation, thus PHP doesn't sit around and wait for the cron to finish. The SP could still update watchdog to it's status. There are many possibilities with SP's. But better to prepare for the future...even though I know only perhaps 1-2% of the Drupal community would ever use them prob. :)

sure, why not?
i think it is reasonable for our abstraction layer to support this even if core doesn't use it for a year or two.
..
That seems like a reasonable approach. MySQL4.1 will be popular/common for at least another year or two so it will be a while before we can really start taking advantage of stored procedures in general. Until then, building a facility in core to use stored procs seems like a small amount of cruft that would be good to exercise a little before it becomes a major way of doing queries.
--
Knaddison Family | mmm Beta Burritos
Please place a break before
Please place a break before or after the code. Breaking in the middle of the code formats the rest of the page as code.