• No results found

ORDBTable class

In document OBJECTSTUDIO. Database User's Guide P (Page 179-186)

The ORDBTable class provides a Table object associated with objects of class

ORDBDatabase. Class summary

Module ordbtb.cls SuperClass ExternalTable

Description Support for UniSQL Server database tables.

Version 2.0

Class hierarchy

Table (ObjectStudio internal table)

ExternalTable (abstract)

ORDBTable

Class usage information Consider the following:

♦ Table names are converted to lowercase. Do not enter table names in uppercase. Attributes (column names) are case-sensitive.

♦ UniSQL Server table attributes (columns) of type bitfield are mapped to ByteArrays in ObjectStudio. The last unused bits of the last byte are 0, if necessary. For example, BIT(10) can hold the value x‘FFC0’ if all bits are set.

♦ An attribute of a UniSQL Server table may be shared. These shared attributes, however, are not supported by ObjectStudio.

♦ Strings are limited to 32,767 bytes in ObjectStudio. Therefore, table attributes/columns that map to the STRING class cannot exceed 32,767 bytes. Otherwise, truncation occurs.

ORDBTable class variables

typesSupported

Description: A list of the UniSQL Server data types.

Database User's Guide, P40-3203-03 179

Chapter: UniSQL Server

ORDBTable instance variables

None

ORDBTable class methods

allowedModifications

Description: Returns a list of allowed modifications to a database table. All modifications, except the delete modification, are supported by the ObjectStudio Database Table Editor.

Assumptions: None

Return value: An Array of Symbols. Receiver modified: No

description

Description: Contains the class reference description. To view the description, select the class name in the Class Browser and then select the Class ⇒ Reference menu option.

Assumptions: None

Return value: The receiver. Receiver modified: No

externalTypeSupport

Description: Returns the class variable typesSupported. typesSupported is an IdentityDictionary where:

♦ The first key/value set has #ExternalTypes as the key and an array of symbols containing the types supported by the external database language as the value.

♦ The second key/value set has #InternalTypes as the key and an array of symbols containing the corresponding types supported by ObjectStudio as the value.

Assumptions: None

Return value: An object of class IdentityDictionary. Receiver modified: No

Database User's Guide, P40-3203-03 180

Chapter: UniSQL Server

initialize

Description: Initializes and returns the class variable typesSupported. See the method reference for the externalTypeSupport method for more information on this variable.

Assumptions: None

Return value: An object of class IdentityDictionary. Receiver modified: No

maxNameLength

Description: Returns the maximum number of characters allowed for a UniSQL Server class identifier.

Assumptions: None

Return value: An object of class SmallInteger. Receiver modified: No

Database User's Guide, P40-3203-03 181

Chapter: UniSQL Server

ORDBTable instance methods

addField: field type: type extType: extType format: format

Description: Adds a new field to the receiver. Adds a nil field to all existing records in the receiver.

Assumptions: field is an object of class Symbol defining the new column name to be added to

the receiver.

type is an object of class Symbol defining the internal type for the new column. extType is an object of class Symbol giving the external type for the new column.

format is an object of class Array containing the format options. It is used by ObjectStudio database tools.

Return value: The receiver or an object of class Message. Receiver modified: Yes

createTableFrom

Description: Physically creates a table.

Assumptions: None

Return value: The receiver or an object of class Message. Receiver modified: Yes

deleteField: fieldName Description: Deletes a table field.

Assumptions: fieldName is the symbol for an existing table field. Return value: The receiver or an object of class Message.

Receiver modified: Yes

Database User's Guide, P40-3203-03 182

Chapter: UniSQL Server

loadInfo

Description: Loads information about a table in the form of an internal table.

Assumptions: None Return value: The receiver. Receiver modified: Yes

print

Description: Returns the string “Table ” plus the dbname instance variable; for example, Table Example.

Assumptions: None

Return value: An object of class String. Receiver modified: No

printExternalTypeFor: aColName

Description: Returns a printable representation of the external data type as it would appear in a CREATE TABLE statement.

Assumptions: aColName is the name of a column defined for the table. Return value: An object of class String.

Receiver modified: No

privateExternalTypeFor: aColName

Description: Returns the external data type needed by the database; for example, in the CREATE TABLE statement.

Assumptions: aColName is the name of a column defined for the table. Return value: An object of class String.

Receiver modified: No

Database User's Guide, P40-3203-03 183

Chapter: UniSQL Server

privateGetColumnLineField: aColName

Description: Returns the column name including the data type needed by the database; for example, in the CREATE TABLE statement.

Assumptions: aColName is the name of a column defined for the table. Return value: An object of class String.

Receiver modified: No

privateGetWidthPrecFixedFor: aColumnName

Description: Returns an array with format information about the column specified by aColumnName. The array always has three entries, each of which is optional:

♦ The information for #Width

♦ The information for #Precision

♦ The information for #Fixed

Assumptions: aColName is the name of a column defined for the table. Return value: An object of class Array.

Receiver modified: No

privateLoad (primitive)

Description: Creates a new instance and loads it with the structure of the table. The table is identified by its name.

Assumptions: None

Return value: A new instance of class ORDBTable, or an object of class Integer for the error

code.

Receiver modified: No

Database User's Guide, P40-3203-03 184

Chapter: UniSQL Server

privateTableCursorNotOpen

Description: Overrides the ExternalDatabase>>privateTableCursorNotOpen instance method.

Assumptions: None

Return value: An object of class String. Receiver modified: No

remove: record using: keyArray

Description: Removes all occurrences of a given record in a specified table based on the criteria in the record and keyArray parameters.

Assumptions: record must be an object of class Array. It specifies the contents of the fields

that will be used as keys for the deletion.

keyArray must be an object of class Array. It gives the field names to be used as a key for the deletion. Field names are of class String.

Return value: The receiver. Receiver modified: Yes

update: record using: keyArray

Description: Updates all occurrences of a record in a specified table based on the criteria in the record and keyArray parameters.

Assumptions: record must be an object of class Array. It specifies the contents of the record.

keyArray must be an object of class Array. It gives the field names to be used as a key for the update. Field names are of class String.

Return value: The receiver. Receiver modified: Yes

Database User's Guide, P40-3203-03 185

Chapter: UniSQL Server

9

In document OBJECTSTUDIO. Database User's Guide P (Page 179-186)

Related documents