SQLiteBLOB.Write

From Xojo Documentation

Method

SQLiteBlob.Write(text As String)

Supported for all project types and targets.

Add the specified text to the BLOB.

Example

This example stores a picture in a BLOB (db is a preexisting database):

Var file As FolderItem
file = FolderItem.ShowOpenFileDialog("")

Var blob As SQLiteBlob
Var dbRowID As Integer = 1
blob = db.CreateBlob("Team", "Logo", dbRowID, file.Length)

If blob <> Nil Then
Try
Var bd As BinaryStream
bd = BinaryStream.Open(file, False)

Var data As String
While Not bd.EOF
data = bd.Read(1000)
blob.Write(data)
Wend
bd.Close
blob.Close
// Do something with the data
Catch error As IOException
MsgBox("Error writing BLOB: " + error.Message
End Try
End If