PDA

View Full Version : Working with BLOBs in Lianja



barrymavin
2012-10-18, 01:49
In Lianja App Builder Beta10 we have added a new function OBJECTSIZE( field ) which returns the size of the BLOB stored in a specified field of the active cursor.

Functions that work on BLOBS are now OBJECTREAD( ), OBJECTWRITE( ), OBJECTTYPE( ) and OBJECTSIZE( ).

You can store any Binary Large Object in an "Object" field of a table including images, documents etc. When building UI sections in the page builder, you can just bind a BLOB to an image gadget or image strip section to have images rendered.

Tip: you can drag and drop image files from your desktop (or double-click the image) onto an existing image to update it. You can also update the contents of an "object" field using the REPLACE command or SQL UPDATE and specify a filename whose contents will be stored in a specified column of a table.



use attachments
seek "somekey"
replace attachment with "c:\somefolder\somefile.png"
update attachments set attachment = "c:\somefolder\somedoc.docx"

Clicking on an attachment hyperlink in an attachments section will extract the BLOB (e.g. document) and open it using the file association for the file extension of the stored BLOB.

The good news is that attachment sections all work in the Lianja Web Client in the cloud as well.

If you want to do all this manually it is quite straightforward,


use attachments
seek "somekey"
objectWrite(attachment, "somefilename." + objectType(attachment) )
Lianja.showDocument( "somefilename." + objectType(attachment) )

Also note that you can use the (soon available) Lianja ODBC Driver to read and write BLOBs from .NET also.