Syntax:
set the table name of {specification} to {name} set the fields of {specification} to {fieldname} type int/char [size {n}] [and ...] set the id of {specification} to {int fieldname} set the id of {specification} to hash {char fieldname} [and {char fieldname} ...] set the specification of {record} to {specification} set field {fieldname} of {record} to {value}
Keyword handler:
linguist.data.keyword.DKSet.class
Runtime handler(s):
linguist.data.handler.DHSet.class
Function:
Set attributes of a specification or a record, as follows:
set the table name of {specification} names the table in the SQL database that will be used to hold records having this specification. Before you can add records to a new table you must first create the table using a record having the appropriate specification.
set the fields of {specification} defines the fields that will be present in every record using this specification. See the example below. Each of the fields can be of type int (not shown) or char with an appropriate field width as shown. They map directly onto SQL data types of the same names.
set the id of {specification} defines how to derive the ID field for a record using this specification. In this implementation, every record must have a single unique numeric ID. If there is no suitable int field in your record you can arrange for one or more char fields to be hashed together and the result used as the ID, as in the example above. This statement is needed to enable the underlying logic to maintain unique IDs for each record in a table, which although not always necessary for SQL in general is a constraint imposed for this package.
set the specification of {record} associates a specification with a record. From this point on you can refer to fields in the record using the names given in the specification, as in the examples below.
set field {fieldname} of {record} assigns a value to a field in a record. The {fieldname} is that given for the specification used by this record. Note: Because this package uses extra application logic, setting a value has no immediate effect on the SQL database itself. Changes are only written when a commit statement is given.
Changes to field values are made only to the local, cached copies of the records. No changes will be made to the SQL database until the commit command is given.
Example(s):
set the table name of CustomerSpec to "Customer" set the fields of CustomerSpec to name type char size 30 and email type char size 60 and company char size 40 and address char size 40 and district char size 40 and city char size 40 and postcode char size 10 and state char size 10 and country char size 20 and phone char size 20 and fax char size 20 and vat char size 15 set the id of CustomerSpec to hash name and email set the id of Order to OrderID set the specification of MyCustomer to CustomerSpec set field name of MyCustomer to "Alfred E Newman" set field email of MyCustomer to "alfred@mad.com" set field company of MyCustomer to "MAD magazine"