Column Data (a_v4_extfn_column_data)

The structure a_v4_extfn_column_data represents a single column's worth of data. This is used by the producer when generating result set data, or by the consumer when reading input table column data.

Implementation

typedef struct a_v4_extfn_column_data {
    a_sql_byte          *is_null;
    a_sql_byte          null_mask;
    a_sql_byte          null_value;

    void                *data;
    a_sql_uint32        *piece_len;
    size_t              max_piece_len;

    void                *blob_handle;
} a_v4_extfn_column_data;

Data Members and Data Types Summary

Data Member Data Type Description
is_null a_sql_byte * Points to a byte where the NULL information for the value is stored.
null_mask a_sql_byte

One or more bits used to represent the NULL value

null_value a_sql_byte

The value representing NULL

data void *

Pointer to the data for the column. Depending on the type of fetch mechanism, either points to an address in the consumer, or an address where the data is stored in the UDF.

piece_len a_sql_uint32 *

The actual length of data for variable-length data types

max_piece_len size_t The maximum data length allowed for this column.
blob_handle void *

A non-NULL value means that the data for this column must be read using the blob API

Description

The a_v4_extfn_column_data structure represents the data values and related attributes for a specific data column. This structure is used by the producer when generating result set data. Data producers are also expected to create storage for data, piece_len, and the is_null flag.

The is_null, null_mask, and null_value data members indicate null in a column, and handle situations in which the null-bits are encoded into one byte for eight columns, or other cases in which a full byte is used for each column.

Example 1

This example shows how to interpret the three fields used to represent NULL: is_null, null_mask, and null_value.

 is_value_null()
	return( (*is_null & null_mask) == null_value )

 set_value_null()
	*is_null = ( *is_null & ~null_mask) | null_value

 set_value_not_null()
	*is_null = *is_null & ~null_mask | (~null_value & null_mask)