lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
PHP and MySQL: stored procedures and heredocs
Played uninspired poker again tonight, so before bed trying to wash the bad taste out of my mouth with a little light reading on stored procedures in MySQL with PHP:

http://forums.mysql.com/read.php?98,19146,19393

Doesn't look promising.

Lately, I've been using heredocs myself. Haven't had any problems thus far. You could create a file to serve as a repository of stored queries like the following:

$SQL['join1'] = <<<SQLJOIN
SELECT $_requested_fields
FROM $_table1
LEFT JOIN $_table2 ON {$_table1}.{$_foreign_key}
WHERE {$_table1}.{$_primary_key} = {$_table2}.{$_foreign_key}
SQLJOIN;


Not sure what the performance implications are exactly.