Exemplo n.º 1
0
 /**
  * Erase record (DROP)
  *
  * @return int
  */
 public function drop()
 {
     list($sql, $values) = $this->compiler->delete($this->name, $this->where);
     // prepare statement & execute
     if ($statement = $this->pdo->prepare($sql) and $result = $statement->execute($values)) {
         return $statement->rowCount();
     }
     // error
     $error = $this->pdo->errorInfo();
     throw new \PDOException('[' . $error[0] . '] ' . $error[2], $error[0]);
 }
Exemplo n.º 2
0
 /**
  * Clear entity data
  *
  * @return bool
  */
 public function clear()
 {
     $sql = $this->compiler->truncateTable($this->name);
     return $this->pdo->query($sql);
 }