Row token
The Row token is sent by the server for every row in a result set, either from a SQL query or a stored procedure call.
The NBCRow packet is exactly the same as the Row packet, it is often used for rows that contain null values (NBC stands for null bitmap compression).
Properties
byte tokenType: the type code for this token (0xD1 for Row, 0xD2 for NBCRow).
String tokenTypeName: the name corresponding to this token's type ("Row" or "NBCRow").
List<ColumnMetadata> columnMetadata: the metadata for this row - one entry per column
DataClassification dataClassification: the data classification for this result set, if defined and available. This is useful only if you need to dynamically look up the classifications, otherwise using getSensitivityPropertiesForColumn (see below) is easier.
Additional properties are the values in the row and can be retrieved by their column name, e.g. context.packet.first_name.
If the column name contains characters such as spaces, dashes, punctuation, etc... you can use the array notation, e.g. context.packet["My special$column"]. Column names are case-sensitive.
Methods
int getIndexOfColumn(string): returns the zero-based index of the column with the given name. If more than one column has the given name, the first one is returned. If no column has the specified name, -1 is returned.
List<ClassificationEntry> getSensitivityPropertiesForColumn(string): returns the data classification entry (see below for details)
ColumnMetadata getMetadataForColumn(string columnName): returns the metadata for the specified column, or null if the name is not that of a column. If the name appears more than once in the row, the first one is returned. If no column has the specified name, null is returned.
void remove(): remove this row from the result set
object duplicate(): creates a copy of this row
The ClassificationEntry object
Properties
string sensitivityLabel: the sensitivity label
string informationType: the information type label
int sensitivityRank: the rank for this entry
Examples
Change the value of a column
if (context.packet.country === 'FR') {
context.packet.balance = 0;
}
Hide columns based on the metadata
Hide the value of all the columns of type varchar:
let pkt = context.packet;
for (let meta of pkt.columnMetadata) {
if (meta.typeInfo.typeName === "varchar") {
pkt[meta.columnName] = "<hidden>";
}
}