LuaSQLite3

View Ticket
Login

View Ticket

Ticket Hash: d54dc056330c7dd23f87226df67b17c22f29d23f
Title: INSERTING a blob (wav-file) can get it back the same...
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: Unable_To_Reproduce
Last Modified: 2018-06-30 19:31:24
Version Found In: Don't know, part of Mushclient 4.94
User Comments:
anonymous added on 2018-02-08 18:39:42: (text/x-fossil-plain)
The following table:
localDB:exec( [[
        CREATE TABLE IF NOT EXISTS soundcache (
        filename TEXT PRIMARY KEY,  -- access path
        ISOtime TEXT, -- time format for If-Modified-Since
        wav BLOB )    -- the content.
        ]] )
The following insert:
stat = localDB:prepare(
            "INSERT OR REPLACE INTO soundcache (filename,ISOtime,wav) "..
            "VALUES (?,?,?)")
        stat:bind(1,filename)
        stat:bind(2,isotime)
        Note("bind="..stat:bind_blob(3,body))
        rc = stat:step()
        if rc == sqlite3.DONE then
            stat:finalize()
            localDB:close()  -- close it
            -- other operations...
        end -- if and so on.
-- retreival:
stat = localDB:prepare(
            "SELECT wav FROM soundcache WHERE filename = ?")  --> returns 0 (sqlite3.OK)
        stat:bind(1,filename)
        stat:step()
        body = stat:get_value(0)
        
I assume the error is happening with the bind_blob, as the different retreival methods are showing a different, shorter result then the original insert.

e added on 2018-06-30 18:42:04: (text/x-fossil-plain)
The version of LuaSQLite3 in MushClient 4.9.4 is 0.7-devel, with some edits by NickGammon.

e added on 2018-06-30 19:31:24: (text/x-fossil-plain)
Added test for this reported detect in [697ae4953a]; cannot reproduce the problem.