Procedures
Procedures
The steps to made and execute a procedure using ivory are very simple and just need a call of method.
Example Create Procedure
require_once('Operations.php');
$ivoryOrm = new Operations();
$arrSelect[] = "name";
$arrWhere[] = [
"propName" => "name",
"fieldValue" => "Jon",
];
$tables[] = "aditional_data";
$select = $ivoryOrm->select($arrSelect, $tables);
$select = $ivoryOrm->where($select, $arrWhere);
//the method select creates the query :
//CREATE PROCEDURE myProcedureName
//AS
//SELECT name FROM aditional_data WHERE name = 'Jon'
//GO;
$createProcedure = $ivoryOrm->createProcedure("myProcedureName", $select);
//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($selectWhere);
Example Run a Procedure
require_once('Operations.php');
$ivoryOrm = new Operations();
//the method executeProcedure calls the runQuery method automatically
//so you dont have to call the runQuery method;
$result = $ivoryOrm->executeProcedure("myProcedureName");
//outputs: EXEC myProcedureName;