Qore TableMapper Module Reference  1.3
All Classes Namespaces Functions Variables Modules Pages
SqlStatementOutboundMapper Class Reference

provides an outbound data mapper to a Table with SqlUtil select hash as a asource More...

Inherits AbstractSqlStatementOutboundMapper.

Public Member Methods

 constructor (SqlUtil::Table source, *hash< auto > sh, hash< auto > mapv, *hash< auto > opts)
 builds the object based on an optional hash providing field mappings, data constraints, and optionally custom mapping logic More...
 
 constructor (SqlUtil::AbstractTable source, *hash< auto > sh, hash< auto > mapv, *hash< auto > opts)
 builds the object based on an optional hash providing field mappings, data constraints, and optionally custom mapping logic More...
 
Qore::SQL::AbstractDatasource getDatasource ()
 returns the AbstractDatasource object associated with this object
 
SqlUtil::AbstractTable getTable ()
 returns the underlying SqlUtil::AbstractTable object More...
 
string getTableName ()
 returns the table name More...
 
hash< string, hash< MapperOptionInfo > > getUserOptions ()
 returns mapper options useful for users
 
 initStatement ()
 initializes the internal statement object
 
hash< auto > optionKeys ()
 returns a list of valid constructor options for this class (can be overridden in subclasses) More...
 

Static Public Member Methods

static *hash< string, AbstractDataField > getStaticInputRecord (AbstractTable table, *hash< auto > select_hash, *reference< string > sql, *hash< auto > input)
 returns a description of the input record based on Qore::SQL::AbstractSQLStatement::describe()
 

Private Member Methods

 initOptions (reference< hash< auto >> opts)
 initializes options
 

Private Attributes

const OptionKeys
 option keys for this class
 
const UserOptions
 user options for this class
 

Detailed Description

provides an outbound data mapper to a Table with SqlUtil select hash as a asource

Member Function Documentation

◆ constructor() [1/2]

SqlStatementOutboundMapper::constructor ( SqlUtil::Table  source,
*hash< auto >  sh,
hash< auto >  mapv,
*hash< auto >  opts 
)

builds the object based on an optional hash providing field mappings, data constraints, and optionally custom mapping logic

The source statement is also scanned using Qore::SQL::SQLStatement and column definitions are used to update the source record specification.

Parameters
sourcethe source table object. A sh select hash is applied to this table
sha SqlUtil select hash
mapva 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 Mapper Specification Format for detailed documentation for this option
optsan optional hash of options for the mapper; see Mapper Options 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()
Exceptions
MAP-ERROR

◆ constructor() [2/2]

SqlStatementOutboundMapper::constructor ( SqlUtil::AbstractTable  source,
*hash< auto >  sh,
hash< auto >  mapv,
*hash< auto >  opts 
)

builds the object based on an optional hash providing field mappings, data constraints, and optionally custom mapping logic

The source statement is also scanned using Qore::SQL::AbstractSQLStatement and column definitions are used to update the source record specification.

Parameters
sourcethe source table object. A sh select hash is applied to this table
sha SqlUtil select hash
mapva 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 Mapper Specification Format for detailed documentation for this option
optsan optional hash of options for the mapper; see Mapper Options 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::AbstractSqlStatementOutboundMapper::getData() or AbstarctSqlStatementOutboundMapper::getDataRows()
Exceptions
MAP-ERROR

◆ getTable()

SqlUtil::AbstractTable SqlStatementOutboundMapper::getTable ( )

returns the underlying SqlUtil::AbstractTable object

Returns
SqlUtil::AbstractTable provided in constructor

◆ getTableName()

string SqlStatementOutboundMapper::getTableName ( )

returns the table name

Returns
string with main table name

◆ optionKeys()

hash<auto> SqlStatementOutboundMapper::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)