Advanced Database Feature Guide


Statements and Statement Descriptors (AbtQuerySpec -> UtyDB2SqlDescriptor)

Replace all references to AbtQuerySpec with a UtyDB2SqlDescriptor using the following rules:

For example, if the application had a method that looked like this:

| qs hs | 
qs := AbtQuerySpec new. 
qs statement: self deleteStatement. 
hs := AbtCompoundType new. 
hs addField: (self fieldForColumnNamed: self primaryKeyColumn). 
self timestampColumn isNil ifFalse: [ 
hs addField: (self fieldForColumnNamed: self timestampColumn) ]. 
qs hostVarsShape: hs. 
qs name: 'DELETE FOR ', self tableName. 
^qs 
 

it could be reworked as follows:

| sd types | 
sd:= UtyDB2DatabaseManager newSqlDescriptor new 
sd sql: self deleteStatement. 
types := EsOrderedDictionary new. 
types add: (self fieldForColumnNamed: self primaryKeyColumn). 
self timestampColumn isNil ifFalse: [ 
types add: (self fieldForColumnNamed: self timestampColumn) ]. 
sd parameterTypes: types. 
sd description: 'DELETE FOR ', self tableName. 
^sd. 
 

The application method fieldForColumnNamed: used in the previous example, would also have to be reworked to return an Association rather than a subclass of the AbtTypeField field. The association’s key would be the name of the field, while the value would be a subclass of the AbtDB2DataType class corresponding to the field’s data type. The following section provides a possible implementation of this method .


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]