I try to insert a slice of bytes into a sqlite3 database, using github.com/mattn/go-sqlite3.
Data:
thmbnail := [255 216 255 219 0 132 ...]
Create statement:
sqlStmt := `
create table result (id INTEGER NOT NULL PRIMARY KEY, fname TEXT, path TEXT,
size INTEGER, fMDate TEXT, fUUID TEXT, fSHA1 TEXT, fPRONOM TEXT, fNSRL INTEGER, fTHMB BLOB);
pragma journal_mode=WAL;
delete from result;
`
Insert:
func addEntryDB(stmt *sql.Stmt, entry fileMD) {
_, err := stmt.Exec(nil, entry.fName, entry.fPath, entry.fSize, entry.fMDate,
entry.fUUID, entry.fSHA1, entry.fPRONOM, entry.fNSRL, entry.fTHMB)
if err != nil {
log.Fatal(err)
}
}
Problem: Only the first four bytes of thmbnail are inserted. I suppose this might be related to the 0 byte on the fifth position.
How can the whole []byte be inserted?