4DQuiz


Import/Export Routines View from small screen devices!  

Import/Export Routines

The following routines provide the ability to import and export objects to 4D BLOB variables. This allows you to easily save and restore objects either to the database or to files on disk.

OT BLOBToObject version 1

OT BLOBToObject(inBLOB {; ioOffset}) Longint

Parameter Type Description

inBLOB BLOB A BLOB which contains an object

ioOffset Longint The offset within the BLOB where

the object can be found

Discussion

OT BLOBToObject retrieves an object from a BLOB into a new object handle. The Object must have been stored in the BLOB with OT ObjectToBLOB, not with VARIABLE TO BLOB.

If ioOffset is not passed in it defaults to zero.

If the bytes at the given offset do not describe an object stored with OT ObjectToBLOB, an error is generated, OK is set to zero, ioOffset is left untouched and a null handle (0) is returned.

Warning The handle returned is a new object that is added to ObjectTools’ internal list of objects. You must be sure to clear the new object with OT Clear when you no longer need it.

See Also

OT ObjectToBLOB, OT ObjectToNewBLOB

OT ObjectToBLOB version 1

OT ObjectToBLOB(inObject; ioBLOB {; inAppend})

Parameter Type Description

inObject Longint An object handle

ioBLOB BLOB A BLOB which receives the object

inAppend Longint 0 to replace ioBLOB’s contents, non

zero to append to ioBLOB

Description

OT ObjectToBLOB stores an object into a BLOB. The previous contents of the BLOB, if any, are completely replaced, unless a non-zero value is passed in inAppend, in which case the object is appended to inBLOB.

Once stored within a BLOB, you must retrieve an object from a it with OT BLOBToObject, not with BLOB TO VARIABLE.

If inObject is not a valid object handle, if ioBLOB is not a valid BLOB, or if memory cannot be allocated to copy the object, an error is generated, OK is set to zero, and ioBLOB is cleared.

Warning Do not attempt to pass a BLOB field or a dereferenced pointer to a BLOB field in the ioBLOB paremeter, as this will result in a crash. If you want to retrieve a BLOB item into a field, either use an intermediate local variable or assign the result of OT ObjectToNewBLOB to the field.

The Object passed to OT ObjectToBLOB is copied into blob and remains in memory. You must be sure to clear it with OT Clear when you no longer need it.

See Also

OT BLOBToObject, OT ObjectToNewBLOB

OT ObjectToNewBLOB version 1.5

OT ObjectToNewBLOB(inObject) BLOB

Parameter Type Description

inObject Longint An object handle

Function result BLOB A new BLOB which contains the object

Description

OT ObjectToNewBLOB stores an object into a new BLOB.

Once stored within a BLOB, you must retrieve an object from a it with OT BLOBToObject, not with BLOB TO VARIABLE.

If inObject is not a valid object handle or if memory cannot be allocated to copy the object, an error is generated, OK is set to zero, and an empty BLOB is returned.

Warning The Object passed to OT ObjectToBLOB is copied into blob and remains in memory. You must be sure to clear it with OT IsObject when you no longer need it.

See Also

OT BLOBToObject, OT ObjectToBLOB



Topics of Interest
Command Reference
 

Published date: Fri, 14 Jul 2006 18:57:30 GMT   → View XML Version

Edit this page now

© 2005 - 2006 4dquiz.com, All trademarks accepted. All Rights Reserved!
Site Index