MyDAC

TCustomMyDataSet.GetFieldEnum Method

Retrieve the list of acceptable values for a specified field given by the FieldName parameter.

Class

TCustomMyDataSet

Syntax

procedure GetFieldEnum(List: TStrings; FieldName: string; TableName: string = '');

Parameters
List
holds the list of acceptable values for a specified field.
FieldName
Holds the field name.
TableName
Holds the table name.

Remarks

Call the GetFieldEnum method to retrieve the list of acceptable values for a specified field given by the FieldName parameter. Field should be of the ENUM or the SET type. If GetFieldEnum is called with the TableName parameter empty, TCustomMyDataSet tries to determine table name searching corresponding field name in the fields requested from server.

Example

The code presented in Example 1) demonstrates the usage of the GetFieldEnum method. This code can be tested on the sample table presented in Example 2). The result output in memo is shown in Example 3).

Example 1)
MyQuery.SQL.Text := 'SELECT `id`, `SET_column` FROM tb_with_set_column';
MyQuery.Open;
MyQuery.GetFieldEnum(Memo.Lines, 'SET_column');

Example 2)
DROP TABLE if EXISTS tb_enum;
CREATE TABLE `tb_enum` (
`uid` INT(11) not NULL PRIMARY KEY AUTO_INCREMENT,
`c_enum` ENUM('value1','value2','value3') DEFAULT NULL
);

Example 3)
value1
value2
value3 
© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback