コード例 #1
0
 public function update(array $aWhere, array $aToSet)
 {
     $this->oPdo->connect();
     $this->formatToDb($aWhere);
     $this->formatToDb($aToSet);
     list($sQuery, $aParameters) = $this->buildUpdateQuery($this->get('entity'), $aWhere, $aToSet);
     try {
         $oPdoStmt = $this->oPdo->perform($sQuery, $aParameters);
     } catch (\PDOException $oException) {
         $sErrMsg = $oException->getMessage() . "\n  Entity: " . $this->get('entity') . "\n  Query: {$sQuery}" . "\n  Parameters: " . print_r($aParameters, true);
         throw new \RuntimeException($sErrMsg);
     }
     return $oPdoStmt;
 }
コード例 #2
0
 /**
  *
  * Connects to the database and sets PDO attributes.
  *
  * @return null
  *
  * @throws \PDOException if the connection fails.
  *
  */
 public function connect()
 {
     $this->pdo->connect();
     $this->logProfiles(__FUNCTION__);
 }