sbme1newtable
Description
Objects of type sbme1newtable are used to create a new database
table in an SBME database file and provide the necessary interface to
create and modify the components of the table. Objects of this type also
do not have a new
() method, since they are
created by a call to the newtable
() method of
the sbme1 object.
Type Tags
None
Object Value
Objects of type sbme1newtable 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 | sbme1newfield | Contains a reference to the sbme1newfield object that represents the first field in the table. |
firstindex | sbme1newindex |
Contains a reference to the sbme1newindex object that represents
the first index on the file. If there are no indexes on the file then
the reference is .nul .
|
sbme | sbme1 | Contains a reference to the sbme1 object that owns the new table. |
tablename | string | Contains the name of the table. |
type | type | Specifies the sbme1newtable type object. |
Methods
create()
Description
Creates the new table in the sbme1 object's file. 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 error
information is output in that error
object.
Prototype
sbme1newtablevar
.create
(
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 .
|
newfield()
Description
This method adds a field to a table definition. The name
and datatype
parameters are required. If the
next
parameter is
.nul
then the field will be added before the
current firstfield
.
Prototype
sbme1newtablevar
.newfield
(
string
,
string | integer | number | boolean | blob | date | time | datetime name
,
sbme1newfield datatype
)
next
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
name | None | string | The name of the field. |
datatype | None | string | integer | number | boolean | blob | date | time | datetime | This parameter receives the actual datatype of the target field. Technically any object that has a value that can be read and written can be passed here, such as the date, time, and datetime types. |
next | .nul | sbme1newfield |
This is the new field before which this new field is to be added. If this
parameter is not supplied, then the new field will be added
before the current firstfield .
|
newindex()
Description
Creates a new index based on the field passed as the first parameter. The
field
parameter
must be supplied. The default
precision
is .nul
(full
precision) except for number fields where it is
1
and must be at greater than 0. The default
algorithm
is the empty string
""
(character value ordering), anotehr alternative
is the Superbase-compatible index algorithm: "SB
Compatible"
.
Prototype
sbme1newtablevar
.newindex
(
sbme1newfield
,
integer field
,
boolean precision
,
string unique
)
algorithm
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
field | None | sbme1newfield | A reference to a sbme1newfield object for which the index will be built. This is a required parameter. |
precision | .nul | integer |
The default value for this is .nul (full precision).
Otherwise it represents the number of bytes of a string or the
number of significant digits from the left of a value to use when
sorting.
|
unique | .false | boolean |
This determines whether the index is limited to unique values or not. If this
is .true , then attempting to save a record
that contains a duplicate value for an index will cause an error.
|
algorithm | "" | string | This is the name of the algorithm to be used for sorting the index. It defaults to the empty string (character value ordering). |