sbme1index
Description
Objects of type sbme1index represent an index for a table in a SBME database file, and provide information that may be needed about the index.
Type Tags
db1index
Object Value
Objects of type sbme1index have no value, and it is an error to try to get or set this value.
Properties
Property | Type | Description |
---|---|---|
_ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. |
__ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. |
algorithm | string |
String indicating the algorithm used in the generation of the index. Currently
the only valid values are .nul and SB
Compatible . The .nul algorithm is in the
same sort order as that used by the comparison operators. The
SB Compatible order is compatible to the sort
order used by Superbase and is also extended to support a fairly
large number of additional Unicode characters.
|
field | sbme1field | Contains a reference to the first sbme1field object that this index is based on. Currently that is the only one. |
next | sbme1index |
Contains a reference to the next sbme1index object for the
table. The sbme1index objects for a table form a closed
loop that is linked by this property.
|
precision | integer |
For full precision this value must be .nul , otherwise it is
a positive integer value that indicates the maximum number of
characters taken from a string value or the maximum number of bytes
of data taken from the most significant end of an integer value when
sorting. For indexes on number fields, this value must be greater
than 0 and defaults to 1 . The
value in this case implies the degree of fraction that is supported:
the default is
1/256th
and 2 permits up to the nearest
1/65536th
and so on.
|
table | sbme1table | Contains a reference to the sbme1table object for the table that contains this index. |
type | type | Specifies the sbme1index type object. |
unique | boolean |
If this value is equal to .true , then the index is
guaranteed to be unique and will cause an error if an attempt is made
to save a record with a duplicate index value.
|
Methods
select()
Description
Selects either the first or the last record in an SBME database table
according to this index. The selection does not depend on the
position of any other record. If the attempt to select a record is
successful then a reference to an object of type
sbme1record is returned. If the attempt is not
successful and the error
parameter is not provided then an error is raised. If the attempt is
not successful and the error
parameter is provided then .nul
is returned and
error information is output in the error
object
provided. Providing the locktype
parameter will allow the record
to be selected with either a shared or exclusive lock.
Prototype
sbme1indexvar
.select
(
boolean
,
string lastrecord
,
integer locktype
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
lastrecord | .false | boolean |
If .false then the first record in the index order is
selected. If .true then the last record in the
index order is selected.
|
locktype | "" | string |
If "shared" or "exclusive" then the
record is selected with a lock of the associated type. An
exclusive lock is required if the record is to be modified or
deleted, and at least a shared lock is required if modification
or deletion by others is to be prevented. These can also be
accomplished by virtue of holding an exclusive lock on the
sbme1table or the sbme1.
|
error | .nul | integer |
Specifies an object that is used to output any error code generated during the
execution of the method. This parameter must be an object, not an
integer value. If error
is not specified or is .nul then any error
that occurs during object creation will halt the program. If an
error object is specified and an error occurs during execution
then the error code is output into that object and the method
returns .nul .
|
selectkey()
Description
Selects a record according to the location of a specified value in the index.
The selection does not depend on the position of any other record. If
the attempt to select a record is successful then a reference to an
object of type sbme1record is returned. If the attempt
is not successful and the error
parameter is not provided then an
error is raised. If the attempt is not successful and the error
parameter is provided then
.nul
is returned and error information is output
in the error
object provided. If an exact match is
not found, but the found
parameter and the error
parameter are provided, then no error will be generated, the
found
parameter will be set
to .false
and the next closest matching record in
the index will be returned. Providing the locktype
parameter will allow the record
to be selected with either a shared or exclusive lock.
Prototype
sbme1indexvar
.selectkey
(
string | integer | boolean | blob
,
string value
,
integer locktype
,
boolean error
)
found
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
value | .nul | string | integer | boolean | blob |
If .nul then a search will be made for the first record in
the index order where the value is empty. If the index is a
string or a blob then a value passed of
this type will be sought for in the index. If the index is of
type integer, date, time,
or datetime then an integer value passed in this
parameter will be sought in the index.
|
locktype | "" | string |
If "shared" or "exclusive" then the
record is selected with a lock of the associated type. An
exclusive lock is required if the record is to be modified or
deleted, and at least a shared lock is required if modification
or deletion by others is to be prevented. These can also be
accomplished by virtue of holding an exclusive lock on the
sbme1table or the sbme1.
|
error | .nul | integer |
Specifies an object that is used to output any error code generated during the
execution of the method. This parameter must be an object, not an
integer value. If error
is not specified or is .nul then any error
that occurs during object creation will halt the program. If an
error object is specified and an error occurs during execution
then the error code is output into that object and the method
returns .nul .
|
found | .nul | boolean |
This must be a boolean object that will be set to
.true if an exact match is found and if an
exact match is not found, then it will be set to
.false .
|