ReasonableFramework supports an SQL mapper it calls SQLX (SQL Extendable). The usage example is as follows:
Write the SQLX query map file:
/storage/sqlx/gentleman.sqlx
SELECT (a.value + b.value) AS gentleman FROM mother a, father b WHERE a.id = b.object_id AND a.name = :aname
Write the helper (library) code with the SQLX query map file:
/helper/gentleman.dbt.php
function coolguy() { $bind = array("aname" => "coolguy"); $sql = get_bind_to_sqlx("gentleman", $bind); $rows = exec_db_fetch_all($sql, $bind); return $rows; }
Use the code in the route (controller) code:
/route/gentleman.php
loadHelper("gentleman.dbt"); var_dump(coolguy());
Check the response: Try connect to
http://localhost/?route=gentleman
in your web browser.