f2s_lob_get_length

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

f2s_lob_get_length {FileName.FieldName} to {variable}
f2s_lob_get_length {FileNumber} {FieldNumber} TO {variable}

Parameter

Description

FileName

The name of the file containing the LOB field

FieldName

The FieldName of the specified LOB field

FileNumber

Number of an open file (FileName.File_Number); available in 18.1

FieldNumber

Numeric DataFlex field number within that file; available in 18.1

variable

The variable to hold the length of the field

Description

Added in Flex2SQL 18.1: The separate FileNumber and FieldNumber form accepts numeric literals, variables, or expressions that supply the file and field numbers. Both numbers are required and are separated by a space. This allows the target field to be selected at runtime. Use the updated 18.1 f2s.pkg and driver for this syntax. The existing FileName.FieldName form remains supported and is the form to use with earlier releases.

The file must already be open. FieldNumber is the DataFlex field number within that file, not a column-name string. You can resolve a field name to its number with Field_Map.

In the separate-number form, TO follows both numbers.

This command is used to get the length of a specified LOB field.

Example

         UChar[] uResult
         Integer iID iLength
         Move 1 to iID
         Open PicturesTest
         Clear PicturesTest
         Move iID to PicturesTest.id
         Find Eq PicturesTest by Index.1
         If (Found) Begin
             f2s_lob_get_length PicturesTest.PictureData to iLength
             Showln "The Length of PictureData:" iLength
         End
         inkey WindowIndex

Separate File and Field Numbers (18.1)

This example resolves PictureData at runtime and passes the two numbers separately:

Integer iLength
Integer iFile iField

Open PicturesTest
Move PicturesTest.File_Number to iFile
Field_Map iFile "PictureData" to iField

Clear PicturesTest
Move 1 to PicturesTest.id
Find Eq PicturesTest by Index.1
If (Found) Begin
    f2s_lob_get_length iFile iField to iLength
    Showln "The length of PictureData: " iLength
End

Replaces

SQL_GET_LOB_LENGTH