|
SYNOPSIS
int createindex(ddic, idxfile, indname, table, field, unique, type)
DDIC *ddic;
char *idxfile;
char *indname;
char *table;
char *field;
int unique;
int type;
DESCRIPTION This function is used to create an index. Ddic is an open DDIC structure,
which defines the database that contains the table to be indexed. Idxfile
is the filename to use to create the index. If it is not a full path it
will be created in the index directory for the database (default: the same
directory as all the other database files). Indname contains the logical
name of the index. This is the name that is referred to when dropping the
index.
Table and field contain the names of the table in ddic, and the field that
are to be indexed. If the last character of the field name is '-' then
the index will be a descending index. Unique defines whether the index
should be a unique index. Currently the index will be created unique, but
no check is currently made when inserting a row.
Type defines what sort of index you want created. The types that are
currently know are as follows:
- INDEX_BTREE
- A btree index. This index is used for rapid retrieval of
particular values or ranges of values. It is similar to
the indexes found in many databases.
(In SQL 'CREATE INDEX ...')
- INDEX_UNIQUE
- A unique btree index. This index is used for rapid
retrieval of particular values or ranges of values while ensuring
that each value only occurs once. It is similar to the indexes
found in many databases.
(In SQL 'CREATE UNIQUE INDEX ...')
- INDEX_MM
- A Metamorph index. This is a special type of index used
to index text fields. It's use is to speed up searches
using
LIKE, and to provide the searches LIKE3 and LIKER.
(In SQL 'CREATE METAMORPH INDEX ...')
- INDEX_FULL
- A Metamorph inverted index. This is a special type
of index used to index text fields. It's use is to speed up
searches using
LIKE and LIKEP.
(In SQL 'CREATE METAMORPH INVERTED INDEX ...')
- INDEX_INV
- Another special type of index. This index has strict
limitations, but speeds up a class of queries dramatically.
The field being indexed must be an UNSIGNED INT or dword.
It speeds up queries where you need to order by that field.
(In SQL 'CREATE INVERTED INDEX ...')
Returns 0 on success and -1 on failure.
SEE ALSO createdbtbl()
Copyright © Thunderstone Software Last updated: Sun Mar 17 21:14:49 EDT 2013
|