SQLite Forum

Why WAL file (-wal) may disappear?
Login
After hours of research, i've narrowed problem down to lua-scripts. There are database interactions in some of my lua-scripts. And some particular of them make WAL file to disappear. I'll list some of it below:

```

// 1.

local query = [[ SELECT val from Parameters WHERE name = "column_name"]]
local period = 0
for row in db:nrows(query) do 
    if row["val"] ~= nil then
        period = row["val"]
    end
end

// 2.

local table = {}
if json ~= nil then
    table["event_id"] = in_json["event_id"]
    local query = [[ SELECT * FROM Events WHERE event_id = "%s" ]]
    query = string.format(query, table["event_id"])    
    for row in db:nrows(query) do
        table = row
    end
else
    json = {}
    local query = [[ SELECT * FROM Events order by created DESC LIMIT 1; ]]
    for row in db:nrows(query) do
        table = row
    end
end

// 3.

function getRow(con, sql)
    local iRow = nil
	for a in con:nrows(sql) do
		iRow = a
	end
	return iRow
end
local termRow = getRow(db,[[SELECT value FROM parameters WHERE name='column_name']])

// 4.

local stmt = db:prepare("SELECT value FROM parameters WHERE name='column_name'")
local cnt = 0
for row in stmt:nrows() do
	cnt = cnt + 1
end
stmt:finalize()	

// 5.

local param = "N"
for Parameter in db_transport:nrows([[SELECT val FROM Parameters WHERE name = 'param']]) do  
    param = SParameter["val"]
end

```