Many of you have already taken the leap and started using ORDA. To ease your coding experience, we are glad to announce that Blobs are now fully supported in ORDA, like any other type. After the first step in 4D v19 R2, with the support of the Blobs in objects, 4D v19 R3 brings the support of Blobs in ORDA.
Save a Blob in the database
You can now use the ORDA syntax to save a Blob in a database. For example, if you want to archive emails in your database:
$IMAPTransporter:=4D.IMAPTransporter.new($parameters)
$blob:=$IMAPTransporter.getMIMEAsBlob()
// Saves the blob in the EmailArchives table
$archive:=ds.EmailArchives.new()
$archive.Date:=Timestamp
$archive.Blob:=$blob
$archive.save()
read a Blob in the database
In the same way, you can use the ORDA syntax to get the contents of a Blob saved in the database. For example, if you want to retrieve an email in your database:
$archive:=ds.EmailArchives.get($id)
$email:=MAIL Convert from MIME($archive.Blob)
Obviously, if your table is encrypted, ORDA manages for you the encryption/decryption of your Blobs.
As usual with Blob fields, keep in mind that a Blob can’t exceed 2GB! For more information, take a look at the documentation.