Exemplo n.º 1
0
 /**
  * initTransaction
  * @return int
  */
 protected function _initTransaction($inputs, $debut)
 {
     try {
         if ($this->transactionRecord == 1) {
             $params = new SimpleObject\OdaPrepareReqSql();
             $params->sql = "INSERT INTO  `api_tab_transaction` (\n                    `id` ,\n                    `type` ,\n                    `statut` ,\n                    `input` ,\n                    `output` ,\n                    `debut` ,\n                    `fin`\n                    )\n                    VALUES (\n                    NULL ,  :type,  'debut',  :input,  '',  :debut,  ''\n                    )\n                ;";
             $strJsonInput = OdaLib::fomatage_json($inputs);
             $params->typeSQL = OdaLibBd::SQL_INSERT_ONE;
             $params->bindsValue = ["type" => ["value" => $_SERVER["SCRIPT_FILENAME"]], "input" => ["value" => $strJsonInput], "debut" => ["value" => $debut->getDateTimeWithMili()]];
             $retour = $this->BD_ENGINE->reqODASQL($params);
             $this->object_retour->id_transaction = $retour->data;
         } else {
             $this->object_retour->id_transaction = 0;
         }
     } catch (Exception $ex) {
         $this->object_retour->strErreur = $ex . '';
         $this->object_retour->statut = self::STATE_ERROR;
         die;
     }
 }