Skip to main content
Version: Next

BLOB PROPERTIES

BLOB PROPERTIES ( blob ; compressed {; expandedSize {; currentSize}} )

ParameterTypeDescription
blobBLOB🡒BLOB for which to get information
compressedLongint🡘0 = BLOB is not compressed, 1 = Compact compression, 2 = Fast compression, -1 = GZIP Best compression, -2 = GZIP Fast compression
expandedSizeLongint🡘Size of BLOB (in bytes) when not compressed
currentSizeLongint🡘Current size of BLOB (in bytes)

Description

The BLOB PROPERTIES command returns information about the BLOB blob.

The compressed parameter returns a value indicating if and how the BLOB is compressed. You can compare this value with the following constants, found in the BLOB theme:

ConstantTypeValueComment
Compact compression modeLongint1Compressed as much as possible (at the expense of the speed of compression and decompression operations). Default method.
Fast compression modeLongint2Compressed as fast as possible (and will be decompressed as fast as possible), at the expense of the compression ratio (the compressed BLOB will be bigger).
GZIP best compression modeLongint-1Most compact GZIP compression
GZIP fast compression modeLongint-2Fastest GZIP compression
Is not compressedLongint0No compression

Whatever the compression status of the BLOB, the expandedSize parameter returns the size of the BLOB when it is not compressed.

The parameter currentSize returns the current size of the BLOB. If the BLOB is compressed, you will usually obtain currentSize less than expandedSize. If the BLOB is not compressed, you will always obtain currentSize equal to expandedSize.

Example 1

See examples for the commands COMPRESS BLOB and EXPAND BLOB.

Example 2

After a BLOB has been compressed, the following project method obtains the percentage of space saved by the compression:

  // Space saved by compression project method
  // Space saved by compression (Pointer {; Pointer } ) -> Long integer
  // Space saved by compression ( -> BLOB {; -> savedBytes } ) -> Percentage
 
 var $1;$2 : Pointer
 var $0;$vlCompressed;$vlExpandedSize;$vlCurrentSize : Integer
 
 BLOB PROPERTIES($1->;$vlCompressed;$vlExpandedSize;$vlCurrentSize)
 If($vlExpandedSize=0)
    $0:=0
    If(Count parameters>=2)
       $2->:=0
    End if
 Else
    $0:=100-(($vlCurrentSize/$vlExpandedSize)*100)
    If(Count parameters>=2)
       $2->:=$vlExpandedSize-$vlCurrentSize
    End if
 End if

After this method has been added to your application, you can use it this way:

  // ...
 COMPRESS BLOB(vxBlob)
 $vlPercent:=Space saved by compression(->vxBlob;->vlBlobSize)
 ALERT("The compression saved "+String(vlBlobSize)+" bytes, so "+String($vlPercent;"#0%")+
 " of space.")

See also

COMPRESS BLOB
EXPAND BLOB