sbme1table
Description
Objects of type sbme1table represent a database table in an
SBME database file and provide the necessary interface to access the
data in the database. Objects of this type also do not have a
new
() method, since they are created by a call
to the opentable
() method of an
sbme1 object.
Type Tags
db1table
Object Value
Objects of type sbme1table 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. |
firstfield | sbme1field | Contains a reference to the sbme1field object that represents the first field in the table. |
firstindex | sbme1index |
Contains a reference to the sbme1index object that represents the
first index on the table. If there are no indexes on the table then
the reference is .nul .
|
locktype | string |
Contains the type of lock currently held on the associated resource. This can
be one of three values: "" (no lock),
"shared" , or "exclusive" . More
than one object can hold a shared lock on a lockable entity, but only
one object can hold an exclusive lock on a lockable entity.
|
recordidfieldname | string |
Contains the name of the field that is being used to show the internal record
ID. If the record ID is not being shown, this field will be equal to
.nul .
|
sbme | sbme1 | Contains a reference to the sbme1 object used to open the table. |
tablename | string | Contains the name of the table. |
type | type | Specifies the sbme1table type object. |
Methods
lock()
Description
The lock
() method is used to acquire a lock on the
sbme1table object. The type of lock can be either shared
or exclusive. It is necessary to hold a shared lock on the
sbme1table object or an exclusive lock on the
sbme1 object to add a record to the table. To prevent
the addition of records to a table, an exclusive lock must be held on
either the table or the sbme1. To release a lock, call
the unlock
() method.
Prototype
sbme1tablevar
.lock
(
string
,
integer locktype
)
error
Parameters
Parameter | Default value | Type name | Description | |||
---|---|---|---|---|---|---|
locktype | None | string |
Contains the type of lock to be acquired on the associated resource.
This must be either
| |||
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 .
|
newrecord()
Description
Creates a sbme1record object to represent a new (as yet not persistently stored) record in the database table.
Prototype
sbme1tablevar
.newrecord
()
Parameters
None
recordcount()
Description
Returns the number of records in the table.
Prototype
sbme1tablevar
.recordcount
()
Parameters
None
select()
Description
Selects either the first or the last record in an SBME database table. The
selection does not depend on any index or 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
sbme1tablevar
.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 table is selected.
If .true then the last record in the table 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 .
|
unlock()
Description
Unlocks the sbme1table object that has previously been locked
with either a shared or exclusive lock using the
lock
method. If the attempt to unlock the
table is successful then .nul
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.
Prototype
sbme1tablevar
.unlock
(
integer
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
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 .
|
sbme1table!
Get
The member operator followed by the name of the field will return a reference to the sbme1field object. If the name provided is not correct (including case-sensitivity), then an error will occur.
Set
Attempting to assign a reference or a value to a sbme1table object using the ! operator is not supported.