415 static *hash<string, AbstractDataField>
getOutputRecord(
string mapper_name, AbstractTable
table, *hash<auto> opts, *hash<SqlUtilDataTypeOptionInfo> field_opts, *hash<auto> mapv);
419 init(hash<auto> mapv, *hash<auto> opts);
425 auto mapFieldType(
string key, hash<auto> mapping, AbstractDataProviderType type,
auto value, hash<auto> rec);
567 *hash<auto>
queueData(hash<auto> rec, *hash<auto> crec);
697 deprecated
static nothing
addBatchToBatch(reference<hash> hb, reference x1, hash batch, *reference x2);
872 init(hash<auto> mapv, *hash<auto> opts);
1159 setup(hash<auto> mapv, *hash<auto> opts);
1264 AbstractSQLStatement m_stmt;
1268 *hash<auto> m_orig_opts;
1458 static *hash<string, AbstractDataField>
getStaticInputRecord(AbstractTable table, *hash<auto> select_hash, *reference<string> sql, *hash<auto>
input);
1466 AbstractDatasource m_ds;
*hash< string, AbstractDataField > input
provides an abstract base for all SQL based outbound mappers
Definition TableMapper.qm.dox.h:1251
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
abstract initOptions(reference< hash > opts)
re-implement to initialize options
static *hash< string, AbstractDataField > getInputRecordFromStmt(AbstractSQLStatement stmt, *hash< auto > input)
returns an input record description from an SQLStatement
SqlStatementMapperIterator iterator()
Returns an SqlStatementMapperIterator based on the current object.
commit()
commits the transaction and frees the Qore::SQL::AbstractDatasource transaction thread resource
rollback()
rolls the transaction back and frees the Qore::SQL::AbstractDatasource transaction thread resource
hash< string, hash< MapperOptionInfo > > getUserOptions()
returns mapper options useful for users
*hash< string, auto > getData()
Retrieve mapped data as a hash of lists.
const OptionDefaults
default option values
Definition TableMapper.qm.dox.h:1259
hash< auto > optionKeys()
returns a list of valid constructor options for this class (can be overridden in subclasses)
constructor(hash< auto > mapv, *hash< auto > opts)
builds the object based on an optional hash providing field mappings, data constraints,...
*list< auto > getDataRows()
Retrieve mapped data as a list of hashes.
abstract initStatement()
re-implement to initialize Qore::SQL::AbstractSQLStatement on demand
const OptionKeys
option keys for this class
Definition TableMapper.qm.dox.h:1255
maps from source to target tables with exactly the same structure
Definition TableMapper.qm.dox.h:820
constructor(SqlUtil::AbstractTable target, hash< auto > mapv={}, *hash< auto > opts)
builds the object based on an optional hash providing field mappings, data constraints,...
constructor(SqlUtil::Table target, hash< auto > mapv={}, *hash< auto > opts)
builds the object based on an optional hash providing field mappings, data constraints,...
hash< string, AbstractDataField > getInputRecord(SqlUtil::AbstractTable table, *hash< auto > opts)
returns a description of the input record based on the AbstractTable source
init(hash< auto > mapv, *hash< auto > opts)
common constructor initialization
provides an inbound data mapper to a Table target
Definition TableMapper.qm.dox.h:273
destructor()
throws an exception if there is data pending in the block cache
Qore::SQL::AbstractDatasource getDatasource()
returns the AbstractDatasource object associated with this object
error(string fmt,...)
prepends the datasource description to the error string and calls Mapper::error()
init(hash< auto > mapv, *hash< auto > opts)
common constructor initialization
constructor(SqlUtil::AbstractTable target, hash< auto > mapv, *hash< auto > opts)
builds the object based on a hash providing field mappings, data constraints, and optionally custom m...
*hash< auto > flush()
flushes any remaining batched data to the database; this method should always be called before commit...
list out_args
extra arguments for sequence output binds
Definition TableMapper.qm.dox.h:302
*hash< auto > flushIntern(bool force_flush)
const OptionKeys
option keys for this object
Definition TableMapper.qm.dox.h:277
bool unstable_input
"unstable input" option for non-optimized inserts/upserts (~33% performance reduction in insert/upser...
Definition TableMapper.qm.dox.h:305
hash record2Batch(hash h)
static nothing addBatchToBatch(reference< hash< auto > > hb, hash< auto > batch)
SqlUtil::AbstractDatabase db
the target Database object in case sequence value need to be acquired
Definition TableMapper.qm.dox.h:293
SqlUtil::AbstractTable table
the target table object
Definition TableMapper.qm.dox.h:290
string getTableName()
returns the table name
static *hash< string, AbstractDataField > getOutputRecord(string mapper_name, AbstractTable table, *hash< auto > opts, *hash< SqlUtilDataTypeOptionInfo > field_opts, *hash< auto > mapv)
returns a description of the output record based on the AbstractTable target
Qore::SQL::AbstractSQLStatement stmt
statement for inserts/upserts
Definition TableMapper.qm.dox.h:308
bool has_returning
if the AbstractTable object supports the "returning" clause
Definition TableMapper.qm.dox.h:296
SqlUtil::AbstractTable getTable()
returns the underlying SqlUtil::AbstractTable object
deprecated hash< auto > insertRowNoCommit(hash< auto > rec)
Plain alias to insertRow(). Obsolete. Do not use.
*code rowcode
per-row Closures or Call References for batch inserts/upserts
Definition TableMapper.qm.dox.h:321
int insert_block
bulk DML block size (also valid for upserts despite the name)
Definition TableMapper.qm.dox.h:311
*hash< auto > queueData(hash< auto > rec, *hash< auto > crec)
inserts/upserts a row (or a set of rows, in case a hash of lists is passed) into the block buffer bas...
*hash< auto > queueData(Qore::AbstractIterator iter, *hash< auto > crec)
inserts/upserts a set of rows (from an iterator that returns hashes as values where each hash value r...
setRowCode(*code rowc)
sets a closure or call reference that will be called when data has been sent to the database and all ...
list ret_args
"returning" arguments for sequences
Definition TableMapper.qm.dox.h:299
nothing commit()
flushes any queued data and commits the transaction
*hash< auto > queueData(list< auto > l, *hash< auto > crec)
inserts/upserts a set of rows (list of hashes representing input records) into the block buffer based...
auto mapFieldType(string key, hash< auto > mapping, AbstractDataProviderType type, auto value, hash< auto > rec)
performs type handling
const UserOptions
User options.
Definition TableMapper.qm.dox.h:281
hash< string, hash< MapperOptionInfo > > getUserOptions()
returns mapper options useful for users
TableMapper::InboundTableMapperIterator iterator(Qore::AbstractIterator i)
returns an iterator for the current object
*list< hash< auto > > getReturning()
returns a list argument for the SqlUtil "returning" option, if applicable
error2(string ex, string fmt,...)
prepends the datasource description to the error description and calls Mapper::error2()
logOutput(hash< auto > h)
ignore logging from Mapper since we may have to log sequence values; output logged manually in insert...
discard()
discards any buffered batched data; this method should be called after using the batch APIs (queueDat...
*code upsert_code
closure used for upserting
Definition TableMapper.qm.dox.h:330
const OptionDefaults
default option values
Definition TableMapper.qm.dox.h:285
hash< auto > insertRow(hash< auto > rec)
inserts or upserts a row into the target table based on a mapped input record; does not commit the tr...
static deprecated nothing addBatchToBatch(reference< hash > hb, reference x1, hash batch, *reference x2)
adds a batch (hash of lists) to another batch (in-place)
constructor(SqlUtil::Table target, hash< auto > mapv, *hash< auto > opts)
builds the object based on a hash providing field mappings, data constraints, and optionally custom m...
*hash< auto > queueDataIntern(hash< auto > rec)
inserts a row into the block buffer based on a mapped input record; does not commit the transaction
hash< auto > optionKeys()
returns a list of valid constructor options for this class (can be overridden in subclasses)
hash hbuf
buffer for bulk DML
Definition TableMapper.qm.dox.h:314
hash< string, bool > validKeys()
returns a list of valid field keys for this class (can be overridden in subclasses)
*int upsert_strategy
upsert strategy option
Definition TableMapper.qm.dox.h:327
checkMapField(string k, reference< auto > fh)
perform per-field pre-processing on the passed map in the constructor
bool upsert
upsert flag
Definition TableMapper.qm.dox.h:324
nothing rollback()
discards any queued data and rolls back the transaction
*int hbuf_size
size of the batch in hbuf as if returned from getRecListSize()
Definition TableMapper.qm.dox.h:318
provides a hash iterator based on a InboundTableMapper object and an iterator input source; for each ...
Definition TableMapper.qm.dox.h:884
setRuntime(hash< auto > runtime)
adds runtime options to the current runtime option hash
hash< auto > getValue()
returns the current row transformed with the mapper
constructor(Qore::AbstractIterator i, SqlUtil::Table target, hash< auto > mapv, *hash< auto > opts, int commit_limit=0)
creates the iterator from the arguments passed
int commit_limit
row commit limit (<= 0 for no commits)
Definition TableMapper.qm.dox.h:893
TableMapper::InboundTableMapper mapc
data mapper
Definition TableMapper.qm.dox.h:890
string getTableName()
returns the table name
bool next()
Moves the current position of the input iterator to the next element; returns False if there are no m...
constructor(Qore::AbstractIterator i, TableMapper::InboundTableMapper mapv, int commit_limit)
creates the iterator from the arguments passed
resetCount()
resets the internal record count
replaceRuntime(*hash< auto > runtime)
replaces runtime options
Qore::SQL::AbstractDatasource getDatasource()
returns the AbstractDatasource object associated with this object
setRuntime(string key, auto value)
set the runtime option with "key" to value "value"
nothing commit()
commits the transaction
int commitLimit()
returns the commit_limit value set in the constructor()
nothing rollback()
rolls back the transaction
constructor(Qore::AbstractIterator i, SqlUtil::AbstractTable target, hash< auto > mapv, *hash< auto > opts, int commit_limit=0)
creates the iterator from the arguments passed
auto getRuntime(string key)
get current runtime option value for a key
hash< auto > val
a copy of the last hash value mapped
Definition TableMapper.qm.dox.h:899
int getCount()
returns the internal record count
constructor(Qore::AbstractIterator i, InboundTableMapper mapper)
creates the iterator from the mapper passed
int cnt
row count for commit
Definition TableMapper.qm.dox.h:896
provides an outbound data mapper to a raw SQL statement
Definition TableMapper.qm.dox.h:1462
hash< auto > optionKeys()
returns a list of valid constructor options for this class (can be overridden in subclasses)
constructor(Qore::SQL::AbstractDatasource ds, string sql, *softlist< auto > sqlargs, hash< auto > mapv, *hash< auto > opts)
builds the obejct based on real SQL statement
const UserOptions
user options for this class
Definition TableMapper.qm.dox.h:1475
hash< string, hash< MapperOptionInfo > > getUserOptions()
returns mapper options useful for users
Qore::SQL::AbstractDatasource getDatasource()
returns the AbstractDatasource object associated with this object
initStatement()
initializes the internal statement object
initOptions(reference< hash< auto > > opts)
initializes options
const OptionKeys
option keys for this class
Definition TableMapper.qm.dox.h:1471
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()
provides a hash iterator based on a mapper object and an SQLStatement or SqlUtil select hash
Definition TableMapper.qm.dox.h:1112
setRuntime(string key, auto value)
set the runtime option with "key" to value "value"
replaceRuntime(*hash< auto > runtime)
replaces runtime options
bool hasBulk()
returns True because this class supports bulk mode
resetCount()
resets the internal record count
constructor(TableMapper::AbstractSqlStatementOutboundMapper mapper)
creates the iterator from the Mapper passed
auto getRuntime(string key)
get current runtime option value for a key
setRuntime(hash< auto > runtime)
adds runtime options to the current runtime option hash
int getCount()
returns the internal record count
hash< auto > getValue()
returns the current row transformed with the mapper
list< auto > mapBulk(int size)
performs bulk mapping by selecting the requested number of rows in a single select
constructor(Qore::SQL::AbstractSQLStatement stmt, hash< auto > mapv, *hash< auto > opts)
creates the iterator from the arguments passed
Mapper::Mapper m_mapper
data mapper
Definition TableMapper.qm.dox.h:1118
constructor(SqlUtil::AbstractTable table, hash< auto > sh, hash< auto > mapv, *hash< auto > opts)
creates the iterator from the arguments passed
constructor(SqlUtil::Table table, hash< auto > sh, hash< auto > mapv, *hash< auto > opts)
creates the iterator from the arguments passed
provides an outbound data mapper to a Table with SqlUtil select hash as a asource
Definition TableMapper.qm.dox.h:1374
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,...
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)
string getTableName()
returns the table name
initStatement()
initializes the internal statement object
const UserOptions
user options for this class
Definition TableMapper.qm.dox.h:1388
initOptions(reference< hash< auto > > opts)
initializes options
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,...
const OptionKeys
option keys for this class
Definition TableMapper.qm.dox.h:1384
Qore::SQL::AbstractDatasource getDatasource()
returns the AbstractDatasource object associated with this object
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()
SqlUtil::AbstractTable getTable()
returns the underlying SqlUtil::AbstractTable object
the TableMapper namespace contains all the definitions in the TableMapper module
Definition TableMapper.qm.dox.h:271