RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TIndexDef.CaseInsFields Property

Specifies which fields of the index are case-insensitive.

Pascal
property CaseInsFields: string;
C++
__property AnsiString CaseInsFields;

Set CaseInsFields to a string that lists the names of fields in the index, separated by semicolons. The ordering imposed by the index on the fields specified in CaseInsFields is case-insensitive. Fields in the index definition but not in the CaseInsFields list use case sensitive ordering (the default for the database type). It is possible that a single index can have fields using both case-insensitive and case-sensitive ordering. 

For a field to be included in CaseInsFields, the field must be included in the fields on which the index is based. These fields are specified in the Fields property of the TIndexDef object.

Note: Not all database servers support both case-insensitive and case-sensitive field orderings in the same index. Consult the documentation for the particular database server used to determine whether this is actually supported. Some database systems require an index be designated case-insensitive as a whole (all of its base fields).
In the example below, the CaseInsFields property is given a list of two table fields for the index being created: LastName and Company.

with Table1 do begin
  ...
  with IndexDefs do begin
    with AddIndexDef do begin
      Name := 'MultiIndex'
      Fields := 'LastName;Company;State'
      Options := [ixUnique];
    end;
    Items[IndexDefs.Count – 1].CaseInFields := 'LastName;Company';
  end;
  ...
  CreateTable;
end;

...

  Table1->IndexDefs->Add("MultiIndex", "LastName;Company;State",
    TIndexOptions() << ixUnique);
  Table1->IndexDefs->Items[Table1->IndexDefs->Count-1]->CaseInsFields = "LastName;Company";
  ...

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!