예제 #1
0
<?php

namespace Project;

require '../header.php';
require '../vendor/autoload.php';
require '../include/config.php';
use stdClass, Oda\OdaLib;
//--------------------------------------------------------------------------
$retours = array();
//--------------------------------------------------------------------------
$retours[] = OdaLib::test("sayHello", function () {
    $v_test = ProjectInterface::sayHello();
    OdaLib::equal($v_test, "hello", "Test OK : Passed!");
});
//--------------------------------------------------------------------------
$resultats = new stdClass();
$resultats->details = $retours;
$resultats->succes = 0;
$resultats->echec = 0;
$resultats->total = 0;
foreach ($retours as $key => $value) {
    $resultats->succes += $value->succes;
    $resultats->echec += $value->echec;
    $resultats->total += $value->total;
}
var_dump($resultats);
예제 #2
0
<?php

namespace Project;

require '../header.php';
require '../vendor/autoload.php';
require '../config/config.php';
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd;
//--------------------------------------------------------------------------
//Build the interface
$params = new OdaPrepareInterface();
$params->arrayInput = array("param_name");
$INTERFACE = new ProjectInterface($params);
//--------------------------------------------------------------------------
// api/exemple.php?milis=123450&ctrl=ok&param_name=nom_site
//--------------------------------------------------------------------------
//EXEMPLE SELECT 1 ROW
$params = new OdaPrepareReqSql();
$params->sql = "SELECT *\n    FROM `api_tab_parametres` a\n    WHERE 1=1\n    AND a.`param_name` = :param_name\n;";
$params->bindsValue = ["param_name" => $INTERFACE->inputs["param_name"]];
$params->typeSQL = OdaLibBd::SQL_GET_ONE;
$retour = $INTERFACE->BD_ENGINE->reqODASQL($params);
$params = new stdClass();
$params->label = "resultat_get_one";
$params->retourSql = $retour;
$INTERFACE->addDataReqSQL($params);
//--------------------------------------------------------------------------
//EXEMPLE SELECT N ROWS
$params = new OdaPrepareReqSql();
$params->sql = "SELECT *\n    FROM `api_tab_parametres` a\n    WHERE 1=1\n;";
$params->typeSQL = OdaLibBd::SQL_GET_ALL;