Module: x2node-rsparser

Database query result set parser module.
Implements:

Requires

Classes

ResultSetParser

Mixins

PropertyDescriptorWithRSParser

Methods


<static> extractValue(type, rawVal [, rowNum] [, colInd])

Call registered value extractor to convert raw database value into the record property value.
Parameters:
Name Type Argument Default Description
type string Value type.
rawVal * Raw value from the database.
rowNum number <optional>
0 Optional result set row number.
colInd number <optional>
0 Optional result set column index.
Returns:
Corresponding value for the record property.
Type
*

<static> getResultSetParser(recordTypes, topRecordTypeName)

Get new result set parser. Before it can be used, the parser instance must be initialized with the markup using init() method.
Parameters:
Name Type Description
recordTypes module:x2node-records~RecordTypesLibrary Record types library.
topRecordTypeName string Name of the record type, records of which are being extracted from the result set.
Returns:
New uninitialized result set parser.
Type
module:x2node-rsparser~ResultSetParser

<static> isSupported(obj)

Tell if the provided object is supported by the module. Currently, only a record types library instance can be tested using this function and it tells if the library was constructed with the x2node-rsparser extension.
Parameters:
Name Type Description
obj * Object to test.
Returns:
true if supported by the rsparser module.
Type
boolean

<static> registerValueExtractor(type, extractorFunc)

Register a custom result set column value extractor.
Parameters:
Name Type Description
type string Value type.
extractorFunc module:x2node-rsparser~valueExtractor Extractor function.

Type Definitions


valueExtractor(rawVal, rowNum, colInd)

Result set column value extractor function.
Parameters:
Name Type Description
rawVal * Raw value returned by the underlying database driver.
rowNum number Current result set row number, starting from zero.
colInd number Column inder, starting from zero.
Returns:
Value to be set in the resulting record object.
Type
*