Example #1
0
 /**
  * 删除数据方法
  * @param $table 表名
  * @param array $where
  * @return int
  */
 public function delete($table, array $where)
 {
     $sql = "delete from {$table} " . $this->whereStr;
     try {
         self::$_link->beginTransaction();
         $stmt = self::$_link->prepare($sql);
         $stmt->execute($where);
         if ($stmt->rowCount() > 0) {
             self::$_link->commit();
             return 1;
         } else {
             self::$_link->rollback();
             $err = $stmt->errorInfo();
             throw new PDOException($err[2]);
         }
     } catch (PDOException $e) {
         MyException::showError($e->getMessage());
     }
 }