示例#1
0
 /**
  * Delete a row from the database.
  *
  * @param string $table The table to delete from.
  * @param array $where Array of where statements to limit deletes.
  * @return int The number of deleted rows.
  * @throws Dabble\Query\DeleteException if no rows were deleted.
  * @throws Dabble\Query\SqlException on error.
  */
 public function execute()
 {
     $stmt = parent::execute();
     if ($affectedRows = $stmt->rowCount() and $affectedRows) {
         return $affectedRows;
     }
     $info = $stmt->errorInfo();
     $msg = "{$info[0]} / {$info[1]}: {$info[2]} - {$this}";
     throw new DeleteException($this->error($msg, $this->bound));
 }
示例#2
0
 public function execute()
 {
     $stmt = parent::execute();
     if (false === ($first = $stmt->fetch(PDO::FETCH_ASSOC))) {
         throw new SelectException($stmt->queryString);
     }
     if (PHP_VERSION_ID < 50500) {
         return include 'simple.php';
     } else {
         return include 'yield.php';
     }
 }