数据库表被锁定了吗?

时间:2015-09-01 10:15:12

标签: php sqlite

PHP版本:5.5,SQLite版本:3.8。

我使用的代码:

try {
      $dbh = new PDO('sqlite:'.MF_DB_PATH.MF_DB_FILE);
      $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch(PDOException $e) {
      $error_connecting =  "Error connecting to the database: ".$e->getMessage();
      $pre_install_error = $error_connecting;
}

$query = "INSERT INTO forms_backup SELECT * FROM forms;";
$params = array();
$sth = $dbh->prepare($query);
try{
    $sth->execute($params);
}catch(PDOException $e) {
    $post_install_error .= $e->getMessage().'<br/><br/>';
}

$query = "DROP TABLE forms;";
$params = array();
try{
    $sth->execute($params);
}catch(PDOException $e) {
    $post_install_error .= $e->getMessage().'<br/><br/>';
}

错误讯息:

  

SQL:[20] DROP TABLE表单;参数:0查询失败:
  SQLSTATE [HY000]:常规错误:6数据库表已锁定

0 个答案:

没有答案