Exemple #1
0
 /**
  * @see \dbeurive\Backend\Database\EntryPoints\AbstractEntryPoint
  */
 public function execute($inExecutionConfig)
 {
     /* @var \PDO $pdo */
     $pdo = $this->getDbh();
     // Execute the request.
     $result = new BaseResult();
     $fieldsValues = UtilArray::array_keep_keys(self::$__insertedFields, $inExecutionConfig, true);
     $req = $pdo->prepare($this->__sql);
     if (false === $req->execute($fieldsValues)) {
         $message = "SQL request failed:\n" . UtilString::text_linearize($this->__sql, true, true) . "\n" . "Condition fields: " . implode(', ', self::$__insertedFields) . "\n" . "Bound to values: " . implode(', ', $fieldsValues);
         $result->setErrorMessage($message);
         return $result;
     }
     $result->setStatusSuccess();
     return $result;
 }
Exemple #2
0
 /**
  * Construct the result of a procedure.
  * @param int $inOptStatus Procedure's status (STATUS_NOT_EXECUTED, STATUS_SUCCESS or STATUS_ERROR).
  * @param array $inOptDataSets List of "data sets" selected by he procedure.
  *        Please note that the term "data set" represents a set of data (which forms a "row" of data).
  *        Data in a set (of data) can be:
  *            * Fields' values returned by the SGBDR.
  *            * Calculated values returned by the SGBDR.
  * @param array $inOptValues List of values computed by the procedure.
  *        Please note that the term "value" represents a data that has been calculated using PHP code.
  *        A "value" is not computed by the SGBDR.
  */
 public function __construct($inOptStatus = self::STATUS_NOT_EXECUTED, array $inOptDataSets = [], array $inOptValues = [])
 {
     parent::__construct($inOptStatus, $inOptDataSets);
     $this->__values = $inOptValues;
 }