SIMPOL Documentation

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

PropertyTypeDescription
_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.
firstfieldsbme1newfield Contains a reference to the sbme1newfield object that represents the first field in the table.
firstindexsbme1newindex 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.
sbmesbme1 Contains a reference to the sbme1 object that owns the new table.
tablenamestring Contains the name of the table.
typetype 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
ParameterDefault valueType nameDescription
error.nulinteger 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 name, string | integer | number | boolean | blob | date | time | datetime datatype, sbme1newfield next )

Parameters
ParameterDefault valueType nameDescription
nameNonestring The name of the field.
datatypeNonestring | 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.nulsbme1newfield 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 field, integer precision, boolean unique, string algorithm )

Parameters
ParameterDefault valueType nameDescription
fieldNonesbme1newfield A reference to a sbme1newfield object for which the index will be built. This is a required parameter.
precision.nulinteger 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.falseboolean 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).