f2s_lob_set¶
Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers
Syntax¶
f2s_lob_set {FileName.FieldName} TO {variable}
f2s_lob_set {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 |
uChar[] array to set the LOB value |
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 for setting the value of a specified LOB field.
Example¶
UChar[] uResult Integer iID iLength iSize 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 f2s_lob_get PicturesTest.PictureData to uResult If (iLength > 0 ) Begin Clear PicturesTest Move "TestBaK" to PicturesTest.PictureName f2s_lob_set PicturesTest.PictureData to uResult SaveRecord PicturesTest End End
Separate File and Field Numbers (18.1)¶
This example resolves PictureData at runtime and passes the two numbers
separately:
UChar[] uResult
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 iFile iField to uResult
// Create a copy using the LOB value read above.
Clear PicturesTest
Move "TestBaK" to PicturesTest.PictureName
f2s_lob_set iFile iField to uResult
SaveRecord PicturesTest
End