6 30 LceGetFieldValueU

LANSA Open Guide

6.30 LceGetFieldValueU

Retrieves the value of a Unicode field. Unicode fields are field types NCHAR and NVARCHAR.

BOOL

LceGetFieldValueU

(int

iSession,

 

 

char far *

strFieldName,

 

 

wchar_t far

strFieldValue,

 

 

int

iFieldValueSize,

 

 

unsigned long far *

pulFlags )

  

Parameters

iSession

The session identifier as returned by LceGetSessionId.

strFieldName

The field name. The field used in this function must have been declared using an LceUseField function.

strFieldValue

The buffer location for the returned value. The field value is stored here once the function has executed successfully. The size should be at least the length of the data in bytes plus the width of Unicode character. The data length may be obtained using LceGetFieldDataLength (see notes). The maximum field size is RDMLX_FIELD_DATA_SIZE as defined in the LCOE.H header file.

iFieldValueSize

The size (in bytes) of strFieldValue.

pulFlags

Identifies the returned value as *SQLNULL. If the field has a value of *SQNULL pulFlags will return 1 otherwise it will return 0.

  

Return Values

TRUE is returned if the session has got the field value.

FALSE is returned if an error occurs.

Notes

This function uses string parameters. Even if the field you are getting is numeric or date/time, it will contain a string value representing the respective numeric or date/time value. You will need to convert the string value to a numeric or date/time before using it in your application. This conversion should be done using the facilities provided with your development toolset. If none are provided, refer for example to the LceASCIIToFloat and LceASCIIToInteger functions.

If a non-Unicode field is passed to this function, it will call LceGetFieldValueX and the returned value will be automatically converted into Unicode.

If using LceGetFieldDataLength to determine the size of the buffer, remember that LceGetFieldDataLength returns the numbers of characters. When allocating the buffer for Unicode and DBCS fields, you may need to adjust the length if the function you are using to allocate the buffer requires the length in bytes rather than characters. To convert characters to bytes you must multiply the number of characters by the size of a Unicode character (normally 2 bytes). For example in C use sizeof( wchar_t ) to get the size of a Unicode character.

  • This function may be executed at any time after the session is opened.
  • This function performs no communications to the host.

Related Functions

6.59 LceSetFieldValueU

6.20 LceGetFieldDataLength