Erel, Can you please give me an example code for this?The simplest solution is to use a temporary file.
- Write the objects to the file with RandomAccessFile.WriteObject.
- Read the file contents into a bytes array and store it as a blob field.
To read the data from the database you will need the opposite operations.
Dim ra As RandomAccessFile
ra.Initialize(File.DirDefaultExternal, "temp1.dat", False)
ra.WriteObject(AllServiceOperations, False, 0)
ra.Close
Dim os1 As OutputStream
Dim is1 As InputStream
is1 = File.OpenInput(File.DirDefaultExternal, "temp1.dat")
os1.InitializeToBytesArray(1000)
File.Copy2(is1, os1)
Dim bytes1() As Byte
bytes1 = os1.ToBytesArray
'ra.ReadBytes(bytes1, 0, bytes1.Length, 0)
sql1.ExecNonQuery2("UPDATE tblJobs SET all_operations=? WHERE device_job_id=?", Array As Object(bytes1, device_job_id))
File.Delete(File.DirDefaultExternal, "temp1.dat") ' deleting the temp file.
Dim output1() As Byte
If sql1.IsInitialized = False Then sql1.Initialize(File.DirDefaultExternal, "jobs.db", True)
output1 = sql1.ExecQuerySingleResult2("SELECT all_operations FROM tblJobs WHERE device_job_id=?", Array As String(device_job_id))
Dim is1 As InputStream
is1.InitializeFromBytesArray(output1, 0, output1.Length)
Dim os1 As OutputStream
os1.InitializeToBytesArray(1000)
File.Copy2(is1, os1)
Dim ra As RandomAccessFile
Thanks mate, but that example still doesn't explain, how to convert to MAP.
Thank you all for the help. I have managed to solve it.Thanks mate, but that example still doesn't explain, how to convert to MAP.