4D v16.3VARIABLE TO BLOB |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
VARIABLE TO BLOB
VARIABLE TO BLOB
The VARIABLE TO BLOB command stores the variable variable in the BLOB blob. If you specify the * optional parameter, the variable is appended to the BLOB and the size of the BLOB is extended accordingly. Using the * optional parameter, you can sequentially store any number of variables or lists (see other BLOB commands) in a BLOB, as long as the BLOB fits into memory. If you do not specify the * optional parameter or the offset variable parameter, the variable is stored at the beginning of the BLOB, overriding its previous contents; the size of the BLOB is adjusted accordingly. If you pass the offset variable parameter, the variable is written at the offset (starting from zero) within the BLOB. No matter where you write the variable, the size of the BLOB is increased according to the location you passed (plus the size of the variable, if necessary). Newly allocated bytes, other than the ones you are writing, are initialized to zero. After the call, the offset variable parameter is returned, incremented by the number of bytes that have been written. Therefore, you can reuse that same variable with another BLOB writing command to write another variable or list. VARIABLE TO BLOB accepts any type of variable (including other BLOBs), except the following:
Note that:
WARNING: If you use a BLOB for storing variables, you must later use the command BLOB TO VARIABLE for reading back the contents of the BLOB, because variables are stored in BLOBs using a 4D internal format. After the call, if the variable has been successfully stored, the OK variable is set to 1. If the operation could not be performed, the OK variable is set to 0; for example, there was not enough memory. Note regarding Platform Independence: VARIABLE TO BLOB and BLOB TO VARIABLE use a 4D internal format for handling variables stored in BLOBs. As a benefit, you do not need to worry about byte swapping between platforms while using these two commands. In other words, a BLOB created on Windows using either of these commands can be reused on Macintosh, and vice-versa. The two following project methods allow you to quickly store and retrieve arrays into and from documents on disk: ` SAVE ARRAY project method After these methods have been added to your application, you can write: ARRAY STRING(...;asAnyArray;...) The two following project methods allow you to quickly store and retrieve any set of variables into and from a BLOB: //STORE VARIABLES INTO BLOB project method After these methods have been added to your application, you can write: STORE VARIABLES INTO BLOB(->vxBLOB;->vgPicture;->asAnArray;->alAnotherArray) The OK variable is set to 1 if the variable has been successfully stored, otherwise it is set to 0.
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v6 TAGS ListRef, Variable ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||