Qore TableMapper Module Reference
1.1
|
provides an inbound data mapper to a Table target More...
Public Member Functions | |
private | checkMap () |
verifies the input map in the constructor | |
private | checkMapField (string k, reference fh, hash th) |
perform per-field pre-processing on the passed map in the constructor More... | |
nothing | commit () |
commits the transaction | |
constructor (SqlUtil::Table table, hash map, *hash opts) | |
builds the object based on a hash providing field mappings, data constraints, and optionally custom mapping logic More... | |
constructor (SqlUtil::AbstractTable table, hash map, *hash opts) | |
builds the object based on a hash providing field mappings, data constraints, and optionally custom mapping logic More... | |
AbstractDatasource | getDatasource () |
returns the AbstractDatasource object associated with this object | |
SqlUtil::AbstractTable | getTable () |
returns the underlying SqlUtil::AbstractTable object | |
string | getTableName () |
returns the table name | |
private bool | hasMapping (hash fh) |
returns True if the field has a mapping, False if not | |
hash | insertRow (hash rec) |
inserts a row into the target table based on a mapped input record; commits the transaction More... | |
hash | insertRowNoCommit (hash rec) |
inserts a row into the target table based on a mapped input record; does not commit the transaction More... | |
private | mapFieldType (string key, hash m, reference v, hash rec) |
performs type handling | |
hash | optionKeys () |
returns a list of valid constructor options for this class (can be overridden in subclasses) More... | |
nothing | rollback () |
rolls back the transaction | |
hash | validKeys () |
returns a list of valid field keys for this class (can be overridden in subclasses) More... | |
Private Attributes | |
SqlUtil::AbstractDatabase | db |
the target Database object in case sequence value need to be acquired | |
SqlUtil::AbstractTable | table |
the target table object | |
provides an inbound data mapper to a Table target
perform per-field pre-processing on the passed map in the constructor
k | the field name |
fh | a reference to the field's value in the map |
TableMapper::InboundTableMapper::constructor | ( | SqlUtil::Table | table, |
hash | map, | ||
*hash | opts | ||
) |
builds the object based on a hash providing field mappings, data constraints, and optionally custom mapping logic
The target table is also scanned using SqlUtil and column definitions are used to update the target record specification, also if there are any columns with NOT NULL constraints and no default value, mapping, or constant value, then a MAP-ERROR exception is thrown
table | the target table object |
map | a hash providing field mappings; each hash key is the name in lower case of the output column in the target table; each value is either True (meaning no translations are done; the data is copied 1:1) or a hash describing the mapping; see Mapper Specification Format for detailed documnentation for this option |
opts | an optional hash of options for the mapper; see Mapper Options for a description of valid mapper options |
MAP-ERROR | the map hash has a logical error (ex: "trunc" key given without "maxlen" , invalid map key) |
TableMapper::InboundTableMapper::constructor | ( | SqlUtil::AbstractTable | table, |
hash | map, | ||
*hash | opts | ||
) |
builds the object based on a hash providing field mappings, data constraints, and optionally custom mapping logic
The target table is also scanned using SqlUtil and column definitions are used to update the target record specification, also if there are any columns with NOT NULL constraints and no default value, mapping, or constant value, then a MAP-ERROR exception is thrown
table | the target table object |
map | a hash providing field mappings; each hash key is the name of the output field; each value is either True (meaning no translations are done; the data is copied 1:1) or a hash describing the mapping; see Mapper Specification Format for detailed documnentation for this option |
opts | an optional hash of options for the mapper; see Mapper Options for a description of valid mapper options |
MAP-ERROR | the map hash has a logical error (ex: "trunc" key given without "maxlen" , invalid map key) |
inserts a row into the target table based on a mapped input record; commits the transaction
$rec | the input record |
MISSING-INPUT | a field marked mandatory is missing |
STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
inserts a row into the target table based on a mapped input record; does not commit the transaction
$rec | the input record |
MISSING-INPUT | a field marked mandatory is missing |
STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
hash TableMapper::InboundTableMapper::optionKeys | ( | ) |
returns a list of valid constructor options for this class (can be overridden in subclasses)
hash TableMapper::InboundTableMapper::validKeys | ( | ) |
returns a list of valid field keys for this class (can be overridden in subclasses)