249 "date_format":
"gives the default format for parsing dates from strings; ex: \"MM/DD/YYYY HH:mm:SS\"",
250 "encoding":
"gives the default output character encoding for string fields",
251 "info_log":
"a call reference / closure for informational logging",
252 "input":
"a hash describing the input record",
253 "input_log":
"a call reference / closure for input record logging",
254 "input_timezone":
"the default timezone to assume when parsing input dates",
255 "name":
"the name of the Mapper object",
256 "number_format":
"the default number format when parsing number fields from strings; ex: \".,\"",
257 "output":
"a hash describing the output record",
258 "output_log":
"a call reference / closure for input record logging",
259 "timezone":
"the default output timezone for date/time values",
260 "runtime":
"runtime options as a hash (see also setRuntime(), replaceRuntime())",
261 "empty_strings_to_nothing":
"converts out record's empty strings and into NOTHING - actually the value is deleted",
278 "number_format":
True,
280 "empty_strings_to_nothing" :
True,
590 private error(
string fmt);
594 private error2(
string ex,
string fmt);
private mapFieldType(string key, hash m, reference v, hash rec)
performs type handling
Qore::AbstractIterator i
input iterator; AbstractIterator::getValue() must return a hash
Definition: Mapper.qm.dox.h:612
int getCount()
returns the internal record count
*hash getOutputRecord()
returns the value of the "output" option
const ConstantConflictList
field keys that conflict with "constant" and "index"
Definition: Mapper.qm.dox.h:245
*string date_format
the global date format for parsing dates
Definition: Mapper.qm.dox.h:337
hash validTypes()
returns a list of valid field types for this class (can be overridden in subclasses) ...
private setup(hash mapv, *hash opts)
sets up the mapper object before checking the mapper hash
private checkInputField(string k, string name)
raises an error if an invalid input field name is declared; only call this if "input" is defined ...
Mapper::Mapper mapc
data mapper
Definition: Mapper.qm.dox.h:654
private any mapSubclass(hash m, any v)
to be overridden as necessary in subclasses
bool next()
Moves the current position of the iterator to the next element; returns False if there are no more el...
list mapBulk(int size)
performs bulk mapping; if the iterator does not support bulk mapping then it is simulated in this met...
string getFieldName(string fname)
returns a descriptive name of the given field if possible, otherwise returns the field name itself ...
bool m_empty_strings_to_nothing
flag to enforce deletion of the empty string in the output record
Definition: Mapper.qm.dox.h:359
const OptionKeys
constructor option keys (can be extended by subclassing and reimplementing optionKeys()) ...
Definition: Mapper.qm.dox.h:248
*code output_log
an optional output data logging callback; must accept a hash giving the output data hash ...
Definition: Mapper.qm.dox.h:319
*code info_log
an optional info logging callback; must accept a sprintf()-style format specifier and optional argume...
Definition: Mapper.qm.dox.h:313
provides a hash iterator based on a mapper object and an iterator input source
Definition: Mapper.qm.dox.h:645
private convertToHash(int t, string k, reference fh)
convert a field definition to a hash if possible
private checkMapField(string k, reference fh, *hash th)
perform per-field pre-processing on the passed map in the constructor
bool allow_dot
do not assume struct when field names have a "." in them; instead allow input field names to have a "...
Definition: Mapper.qm.dox.h:331
this class is a base class for mapping data; see Mapper Examples for usage examples ...
Definition: Mapper.qm.dox.h:240
setRuntime(string key, any value)
set the runtime option with "key" to value "value"
hash mapc
the hash providing output field names and mappings
Definition: Mapper.qm.dox.h:304
hash getValue()
returns the current row transformed with the mapper
int count
count of records mapped
Definition: Mapper.qm.dox.h:349
resetCount()
resets the internal record count
constructor(Qore::AbstractIterator i, hash mapv, *hash opts)
creates the iterator from the arguments passed
*string number_format
the global number format for parsing numbers
Definition: Mapper.qm.dox.h:340
Qore::TimeZone input_timezone
the timezone for input fields in case of parsing text values; if not set defaults to the current Time...
Definition: Mapper.qm.dox.h:325
private error2(string ex, string fmt)
throws the given exception; prepends the map name to the description if known
abstract base class for hash iterator mappping classes based on a mapper object and an iterator input...
Definition: Mapper.qm.dox.h:603
hash validKeys()
returns a list of valid field keys for this class (can be overridden in subclasses) ...
bool allow_output_dot
do not assume structured/hash output when output field names have a "." in them; instead allow output...
Definition: Mapper.qm.dox.h:334
const ValidKeys
default known mapper hash field keys (can be extended by subclassing and reimplementing validKeys()) ...
Definition: Mapper.qm.dox.h:265
private checkMap()
verifies the input map in the constructor
private error(string fmt)
throws a MAP-ERROR exception; prepends the map name to the description if known
*Qore::TimeZone timezone
an optional timezone for output date fields
Definition: Mapper.qm.dox.h:322
logOutput(hash h)
calls the output logging closure or call reference (if any) to log the output record ...
bool trunc_all
truncate all option
Definition: Mapper.qm.dox.h:328
const ValidTypes
default known field types (can be extended by subclassing and reimplementing validTypes() and mapFiel...
Definition: Mapper.qm.dox.h:284
hash mapData(hash rec)
processes the input record and returns a hash of the mapped values where the keys in the hash returne...
constructor(Qore::AbstractIterator iter)
creates the iterator from the arguments passed
*hash output
an optional description of the output data structure
Definition: Mapper.qm.dox.h:346
private checkTimezoneOption(hash opts, string rn)
verifies a timezone constructor option
private constructor()
private constructor for subclasses
private hash mapDataIntern(hash rec)
processes the input record and returns a hash of the mapped values where the keys in the hash returne...
bool hasBulk()
returns True if the iterator supports bulk mode; this method returns False (the default) ...
*string name
the optional name for the object (for example a table name); will be prepended to field names in erro...
Definition: Mapper.qm.dox.h:310
string encoding
the output character encoding; if not given then the output encoding is assumed to be UTF-8 ...
Definition: Mapper.qm.dox.h:307
int getCount()
returns the internal record count
hash optionKeys()
returns a list of valid constructor options for this class (can be overridden in subclasses) ...
*hash input
an optional description of possible input hash keys
Definition: Mapper.qm.dox.h:343
*hash getInputRecord()
returns the value of the "input" option
list mapAll(list recs)
maps all input records and returns the mapped data as a list of output records
*code input_log
an optional input data logging callback; must accept a hash giving the input data hash ...
Definition: Mapper.qm.dox.h:316
replaceRuntime(*hash runtime)
replaces runtime options
any getRuntime(string key)
get current runtime option value for a key
const OutputKeys
output option keys
Definition: Mapper.qm.dox.h:293
bool valid()
returns True if the iterator is currently pointing at a valid element, False if not ...
*hash m_runtime
current runtime values
Definition: Mapper.qm.dox.h:354
resetCount()
resets the internal record count