SQL Error: "database disk image is malformed"

    local query = "CREATE TABLE cl_db ( "
    query = query .. "name TEXT, "
    query = query .. "value INTEGER"
    query = query .. " );"
    local result = sql.Query( query )
    if result == false then
      print( sql.LastError() )

database disk image is malformed

i tried some sql an this is was printed out
how can i fix that / what is wrong?

Use SQLite browser to extract tables which have data you wan’t to keep into a new sv.db file. You have corrupted your database.

You can also make a new database with sqlite browser. Once you have a new database lets go over the code…

There is no reason (far as I can see) for concatenation of your variable query. You don’t event need to put the query in a variable, but if you must, it should just look like this

local query = "CREATE TABLE cl_db (name TEXT, value INTEGER)"

-- somewhere else in the code

But usually, your query would look like this:

sql.Query("CREATE TABLE cl_db (name TEXT, value INTEGER)")