provides an outbound data mapper to a raw SQL statement
More...
|
| constructor (Qore::SQL::AbstractDatasource ds, string sql, *softlist< auto > sqlargs, hash< auto > mapv, *hash< auto > opts) |
| builds the obejct based on real SQL statement
|
|
Qore::SQL::AbstractDatasource | getDatasource () |
| returns the AbstractDatasource object associated with this object
|
|
hash< string, hash< MapperOptionInfo > > | getUserOptions () |
| returns mapper options useful for users
|
|
hash< auto > | optionKeys () |
| returns a list of valid constructor options for this class (can be overridden in subclasses)
|
|
| commit () |
| commits the transaction and frees the Qore::SQL::AbstractDatasource transaction thread resource
|
|
| constructor (hash< auto > mapv, *hash< auto > opts) |
| builds the object based on an optional hash providing field mappings, data constraints, and optionally custom mapping logic
|
|
*hash< string, auto > | getData () |
| Retrieve mapped data as a hash of lists.
|
|
*list< auto > | getDataRows () |
| Retrieve mapped data as a list of hashes.
|
|
abstract Qore::SQL::AbstractDatasource | getDatasource () |
| returns the AbstractDatasource object associated with this object
|
|
Qore::SQL::SQLStatement | getRowIterator () |
| returns a row iterator for the underlying SQL statement for this object
|
|
Qore::SQL::AbstractSQLStatement | getStatement () |
| returns a row iterator for the underlying SQL statement for this object
|
|
hash< string, hash< MapperOptionInfo > > | getUserOptions () |
| returns mapper options useful for users
|
|
SqlStatementMapperIterator | iterator () |
| Returns an SqlStatementMapperIterator based on the current object.
|
|
hash< auto > | optionKeys () |
| returns a list of valid constructor options for this class (can be overridden in subclasses)
|
|
| rollback () |
| rolls the transaction back and frees the Qore::SQL::AbstractDatasource transaction thread resource
|
|
|
static *hash< string, AbstractDataField > | getStaticInputRecord (Qore::SQL::AbstractDatasource ds, string sql, *softlist< auto > args, *hash< auto > input) |
| returns a description of the input record based on Qore::SQL::AbstractSQLStatement::describe()
|
|
|
| initOptions (reference< hash< auto > > opts) |
| initializes options
|
|
| initStatement () |
| initializes the internal statement object
|
|
abstract | initOptions (reference< hash > opts) |
| re-implement to initialize options
|
|
abstract | initStatement () |
| re-implement to initialize Qore::SQL::AbstractSQLStatement on demand
|
|
|
const | OptionKeys = ... |
| option keys for this class
|
|
const | UserOptions = ... |
| user options for this class
|
|
|
const | OptionDefaults = ... |
| default option values
|
|
const | OptionKeys = ... |
| option keys for this class
|
|
static *hash< string, AbstractDataField > | getInputRecordFromStmt (AbstractSQLStatement stmt, *hash< auto > input) |
| returns an input record description from an SQLStatement
|
|
provides an outbound data mapper to a raw SQL statement
◆ constructor()
TableMapper::RawSqlStatementOutboundMapper::constructor |
( |
Qore::SQL::AbstractDatasource | ds, |
|
|
string | sql, |
|
|
*softlist< auto > | sqlargs, |
|
|
hash< auto > | mapv, |
|
|
*hash< auto > | opts ) |
builds the obejct based on real SQL statement
The source statement is also scanned using Qore::SQL::AbstractSQLStatement and column definitions are used to update the source record specification.
- Parameters
-
ds | Qore::SQL::AbstractDatasource instance. Note that this object uses a transaction lock for the current thread. |
sql | a string with SQL statement. Variables binding is provided by sqlargs |
sqlargs | optional list with sql argumets/variables |
mapv | a optional hash providing overrides for the default 1:1 input to output 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 mapperkeys for detailed documentation for this option |
opts | an optional hash of options for the mapper; see mapperoptions for a description of valid mapper options plus the following options specific to this object:
"select_block" : for size of the batch returned from TableMapper::AbstarctSqlStatementOutboundMapper::getData() or AbstarctSqlStatementOutboundMapper::getDataRows()
|
- Example
{.py}
%new-style
%requires TableMapper
Datasource ds("oracle:omq/omq@xbox");
on_success ds.commit();
on_error ds.rollback();
hash MAPV = ("id" : "workflowid", "name" : True);
RawSqlStatementOutboundMapper m(ds, "select * from workflows where workflowid = %v or workflowid = %v", (1,2), MAPV);
printf("%N\n", m.getDataRows());
◆ optionKeys()
hash< auto > TableMapper::RawSqlStatementOutboundMapper::optionKeys |
( |
| ) |
|
returns a list of valid constructor options for this class (can be overridden in subclasses)
- Returns
- a list of valid constructor options for this class (can be overridden in subclasses)