Switch to: V14V13V12V11V10V9V8V7V6V5

9. Indexes in API

This section will help you to see the whole picture how to work with Indexes using API way.

New Fields

For a new field of table you can specify flags: fIndexed, fIndexUnique, fIndexByWords and fIndexHashed.

fld = tbl.CreateVarCharField( "fld_name", 2044, fIndexed + fUnique )

Existed Fields

  • For existed field you can change index and if it exists at all using properties of VField: IsIndexed, IsUnique, IndexHashed.
  • For existed String/VarChar/Text fields you can use property IndexByWords.
fld.IsIndexed = false
fld.IsUnique = true

Index Changes

Note also VTable.IndexChanges property. It allows in one line of code disable changes in indexes when you do massive changes. After changes done, enable index changes back, this will cause reindex of all indexes of this table. Advantage - you should not self save/restore state of index-related flags for each field.