So I have this database-to-become-one with a table like
CREATE TABLE IF NOT EXISTS "Programs" ( "ProgramID" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "ProgramName" varchar(128) NOT NULL, "ProgramPath" varchar(256), "ProgramContent" varchar(10000) NOT NULL, "ProgramHash" blob NOT NULL );
I am reading numerous text files, generate a content hash, check if the database knows name, path and hash of the current file and depending on outcome either update, insert or ignore an entry.
Quite basic, and expectedly the code runs without errors.
Only I found some rows will have an empty content column afterwards, which basically shouldn’t be possible. I made sure the size limit is not exceeded by them, I made sure they do have valid content and I also check db.ErrorCode, suspecting there’d be no database exception. Nothing.
An idea why a column which must not be null might have a null content after insert?
Version is Xojo 2023r1, database is SQLite with Xojo default plugin.
var s As String var b As Boolean = f.ReadFileMBS(s) If b Then s = s.DefineEncoding(Encodings.utf8).Trim If s.IsEmpty Then Break If isupdate Then db.ExecuteSQL("Update Programs set ProgramContent = ?, ProgramHash = ? where ProgramPath = ? and ProgramName = ?", s, hash, path, name) Else db.ExecuteSQL("Insert into Programs (ProgramName, ProgramPath, ProgramContent, ProgramHash) Values (?,?,?,?)", name, path, s, hash) End If If db.ErrorCode <> 0 Then s = db.ErrorMessage End If