You are not logged in.
Hello,
The orm field is set type as below:
TTestColor = (Red,Green,Blue);
TTestColors = set of TTestColor;
TTestOrm = class(Torm)
FColors: TTestColors;
property
Colors: TTestColors read FColors write FColors;
end;
....
LTestOrm.Colors := Red + Blue;
then Is it possible to select the set field which included set value?
Likewise "Select Colors from TestOrm where colors in [Red]"
Offline
Not directly in SQL or ORM because the set is stored as integer, and the DB itself doesn't know anything about the set definition.
But you can search at binary/number level using SQL Bitwise Operators:
var col: TTestColors;
begin
col := [Red];
table := orm.MultiFieldValues(TTestOrm, '*', '(colors & ?) <> 0', [byte(col)]);
Of course, it can't use an index, due to the nature of how indexes work.
Offline