Qore TableMapper Module Reference
1.0
|
provides a hash iterator based on a InboundTableMapper object and an iterator input source; for each iteration the iterted row is inserted into the Table target More...
Public Member Functions | |
nothing | commit () |
commits the transaction | |
int | commitLimit () |
returns the commit_limit value set in the constructor() | |
constructor (Qore::AbstractIterator i, SqlUtil::Table table, hash map, *hash opts, int commit_limit=0) | |
creates the iterator from the arguments passed More... | |
constructor (Qore::AbstractIterator i, SqlUtil::AbstractTable table, hash map, *hash opts, int commit_limit=0) | |
creates the iterator from the arguments passed More... | |
constructor (Qore::AbstractIterator i, TableMapper::InboundTableMapper map, int commit_limit=0) | |
creates the iterator from the arguments passed More... | |
int | getCount () |
returns the internal record count More... | |
string | getTableName () |
returns the table name | |
hash | getValue () |
returns the current row transformed with the mapper | |
bool | next () |
Moves the current position of the input iterator to the next element; returns False if there are no more elements otherwise inserts the row in the target table and returns True. More... | |
resetCount () | |
resets the internal record count More... | |
nothing | rollback () |
rolls back the transaction | |
Private Attributes | |
int | cnt = 0 |
row count for commit | |
int | commit_limit |
row commit limit (<= 0 for no commits) | |
TableMapper::InboundTableMapper | map |
data mapper | |
hash | val |
a copy of the last hash value mapped | |
provides a hash iterator based on a InboundTableMapper object and an iterator input source; for each iteration the iterted row is inserted into the Table target
TableMapper::InboundTableMapperIterator::constructor | ( | Qore::AbstractIterator | i, |
SqlUtil::Table | table, | ||
hash | map, | ||
*hash | opts, | ||
int | commit_limit = 0 |
||
) |
creates the iterator from the arguments passed
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
i | input iterator; AbstractIterator::getValue() must return a hash |
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 |
commit_limit | row count before a commit is made; if <= 0 then no commits are made by this object, otherwise a commit is made for each commit_limit rows processed by this object, commits are made in calls to next() |
TableMapper::InboundTableMapperIterator::constructor | ( | Qore::AbstractIterator | i, |
SqlUtil::AbstractTable | table, | ||
hash | map, | ||
*hash | opts, | ||
int | commit_limit = 0 |
||
) |
creates the iterator from the arguments passed
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
i | input iterator; AbstractIterator::getValue() must return a hash |
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 |
commit_limit | row count before a commit is made; if <= 0 then no commits are made by this object, otherwise a commit is made for each commit_limit rows processed by this object, commits are made in calls to next() |
TableMapper::InboundTableMapperIterator::constructor | ( | Qore::AbstractIterator | i, |
TableMapper::InboundTableMapper | map, | ||
int | commit_limit = 0 |
||
) |
creates the iterator from the arguments passed
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
i | input iterator; AbstractIterator::getValue() must return a hash |
map | the mapper to transform the data |
commit_limit | row count before a commit is made; if <= 0 then no commits are made by this object, otherwise a commit is made for each commit_limit rows processed by this object, commits are made in calls to next() |
int TableMapper::InboundTableMapperIterator::getCount | ( | ) |
returns the internal record count
bool TableMapper::InboundTableMapperIterator::next | ( | ) |
Moves the current position of the input iterator to the next element; returns False if there are no more elements otherwise inserts the row in the target table and returns True.
if commit_limit is > 0 then TableMapper::InboundTableMapper::commit() is called for every commit_limit rows according to the internal row count
TableMapper::InboundTableMapperIterator::resetCount | ( | ) |
resets the internal record count