If I need to store a file from the disk into a database blob, how do
I do it?
Here is my try, but I of course get an error when trying to assign
the folderitem to the database record column.
I am not sure how to get the actual file in memory to assign it to
the binary sqlite column.
Thanks for any help.
Jeff Edwards
________________________________________________________________
Dim f as FolderItem
dim sql as string
f=GetFolderItem(kDatabaseName)
if (not(f.exists)) then
//create the database
Dim db as REALSQLdatabase
f= New FolderItem(kDatabaseName)
db= New REALSQLdatabase
db.databaseFile=f
If db.CreateDatabaseFile then
sql = "create table server (id integer, server_name varchar,
version varchar, theFile binary)"
db.SQLExecute(sql)
dim errormessage as string
errormessage = db.ErrorMessage
if (errormessage<>"") then
msgbox errormessage
end if
Dim rec as DatabaseRecord
rec= new Databaserecord
rec.IntegerColumn("id") = 1
rec.Column("server_name") = "a_name"
rec.Column("version") = "1.0.0"
Dim myFile, myFileCopy as FolderItem
myFile=GetFolderItem("MyFile.zip")
myFileCopy = new folderItem(myFile)
rec.Column("theFile") = myFileCopy // THIS IS THE
OFFENDING LINE
db.InsertRecord("server",rec)
db.Commit
db.close
else
MsgBox "Database not created"
end if
end if
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>