首页  编辑  

dBase的复合索引

Tags: /超级猛料/Database.数据库相关/Paradox & dBase/   Date Created:

复合索引必须是表达式,例如:

MyTable.AddIndex('MyTagName', 'FIELD1NAME+FIELD2NAME', [ixExpression]);

his is required on compound indices.  You can even use other expressions, such as UPPER(FIELD1+FIELD2).  Note that [ixExpression] is required, but NOT documented in any help file I can find, and [ixCaseInsensitive] plain doesn't work for dBase files.

Note further that such expression indices rule out using SetRange, and perhaps other methods.  However, I've heard that using the "long winded" version of SetRange will work.  

e.g.

with table1 do

begin

 SetRangeStart;

 FieldsByName('FIELD1').AsString := 'myString';

 FieldsByName('FIELD2').AsString := '  1';

 SetRangeEnd;

 FieldsByName('FIELD1').AsString := 'myString';

 FieldsByName('FIELD2').AsString := '999';

 ApplyRange;

end;