database table is locked
Hello, I'm beginner in SQL/PHP,I want to delete a column from a table with sqlite3, I use this method but when I try to execute it with php I have this error when I execute the query :
$statement = $pdo->exec("CREATE TABLE t1_backup AS SELECT $columns FROM $tableName;DROP TABLE $tableName;ALTER TABLE t1_backup RENAME TO $tableName;");
Error : Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 6 database table is locked
Whereas it works if I manually execute the query... What's the problem ?? I tried to add sleep() but nothing... I tried to execute query one by one but nothing... I try to add "BEGIN TRANSACTION" & "COMMIT" but nothing... Thank you !
This repo is for the Go wrapper around the SQLite C library. For problems with SQLite itself, you should ask in the forum. https://sqlite.org/forum/forummain
I can say that the "database table is locked" error is an implication of using shared cache mode, which you should avoid using in general. https://www.sqlite.org/sharedcache.html