go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

database table is locked

Open LVDB45 opened this issue 4 years ago • 1 comments

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 !

LVDB45 avatar Mar 21 '21 23:03 LVDB45

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

rittneje avatar Mar 22 '21 00:03 rittneje