SQLite Forum

table locked when dropping a temp table
Login
In any case I traced the calls that my project does (using a zeos provided monitor) and I cannot see where the problem is.
These are all the calls until the "table is locked" error:

```
2020-06-20 22:41:50 cat: Connect, proto: sqlite-3, msg: CONNECT TO "/home/luca/Datos/boda_t10_l3_pc/nuevo_comisionado/datos/ajustes.tmp" AS USER ""
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 1 : PRAGMA cache_size = 10000
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 1
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 1 : PRAGMA show_datatypes = ON
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 1
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 1 : PRAGMA foreign_keys = 1
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 1
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 2 : select * from variables order by orden

2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 3 : PRAGMA table_info('variables')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 3
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 2
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 4 : select * from variables

2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 4
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 5 : select * from tipocampo

2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 6 : PRAGMA table_info('tipocampo')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 6
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 5
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 7 : select * from campos order by id

2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 8 : PRAGMA table_info('campos')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 8
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 7
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 9 : select * from valores where campo=? order by orden
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 9 : 1,
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 10 : PRAGMA table_info('valores')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 10
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 9
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 9 : 1,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 9
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 11 : select * from campos

2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 11
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 12 : select * from plcs

2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 13 : PRAGMA table_info('plcs')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 13
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 12
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 14 : select numero,color_fondo, color_letra from casillas where pantalla=? and numero>0 and numero<=? order by numero
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 14 : 0,0,
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 15 : PRAGMA table_info('casillas')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 15
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 14
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 14 : 0,0,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 14
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 16 : select * from plcs

2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 16
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 17 : select * from pantallas order by numero

2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 18 : PRAGMA table_info('pantallas')
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 18
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 17
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 14 : 1,9,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 14
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 19 : select * from casillas where pantalla=? and numero>0 and numero<=? order by numero
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 19 : 1,9,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 19
2020-06-20 22:41:50 cat: Prepare, proto: sqlite-3, msg: Statement 20 : select * from casillas where pantalla=? and numero=0
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 20 : 1,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 20
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 14 : 1,9,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 14
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 19 : 1,9,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 19
2020-06-20 22:41:50 cat: Bind prepared, proto: sqlite-3, msg: Statement 20 : 1,
2020-06-20 22:41:50 cat: Execute prepared, proto: sqlite-3, msg: Statement 20
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 21 : BEGIN

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 21
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 22 : PRAGMA defer_foreign_keys = on

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 22
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 23 : UPDATE TriggerControl set enabled=0

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 23
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 24 : DROP TABLE IF EXISTS x

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 24
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 25 : CREATE TEMP TABLE x AS SELECT * FROM variables WHERE orden>=?
2020-06-20 22:42:18 cat: Bind prepared, proto: sqlite-3, msg: Statement 25 : 4,
2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 25
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 26 : UPDATE x SET orden=orden+1

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 26
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 27 : DELETE FROM variables WHERE orden>=?
2020-06-20 22:42:18 cat: Bind prepared, proto: sqlite-3, msg: Statement 27 : 4,
2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 27
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 28 : INSERT INTO variables SELECT * FROM x

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: Statement 28
2020-06-20 22:42:18 cat: Prepare, proto: sqlite-3, msg: Statement 29 : DROP TABLE x

2020-06-20 22:42:18 cat: Execute prepared, proto: sqlite-3, msg: DROP TABLE x
, errcode: 6, error: Error: database table is locked
Message: database table is locked
```