mardi 1 septembre 2015

SQLite : Database table is locked?

PHP version :5.5 SQLite version :3.8

the code i use:

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/>';
}

error message: SQL: [20] DROP TABLE forms; Params: 0 Query Failed: SQLSTATE[HY000]: General error: 6 database table is locked

Aucun commentaire:

Enregistrer un commentaire