Example #1
0
 public function write()
 {
     try {
         $requete = $this->requeteSQL();
         $tables = $this->tables();
         $parametres = $this->parametres()->getParametres();
         $sql = new _SQL();
         $sql->connexion();
         $req = $sql->prepare($requete, $tables);
         if (isset($parametres)) {
             foreach ($parametres as $champ => $valeur) {
                 $sql->parametre($req, $champ, $valeur);
             }
         }
         $sql->execute($req);
         $sql->deconnexion();
     } catch (Exception $ex) {
         throw $ex;
     }
 }
Example #2
0
 /**
  * Retourne le résultat de la requete
  * @return PDOStatement 
  */
 public function read()
 {
     try {
         $requete = $this->requeteSQL();
         $tables = $this->tables();
         $parametres = !is_null($this->parametres()) ? $this->parametres()->getParametres() : null;
         $sql = new _SQL();
         $sql->connexion();
         $req = $sql->prepare($requete, $tables);
         if (!is_null($parametres) && is_array($parametres)) {
             foreach ($parametres as $champ => $valeur) {
                 $sql->parametre($req, $champ, $valeur);
             }
         }
         $sql->execute($req);
         $result = $this->retours($req);
         $sql->deconnexion();
         return $result;
     } catch (Exception $ex) {
         throw $ex;
     }
 }