Data Conversion Functions

The ESP Server uses these APIs to convert data within the custom internal adapter implementation.

These functions are used for both input and output adapters.

API Valid RowType Description
void* createConnectionRow(const char *type); All Creates a ConnectionRow object of a given type and its related ConnectionRowWrapper object. The valid values for type are:
  • RowByName – stores data internally as name-value pairs.
  • RowByOrder – stores data internally as an indexed vector.
void deleteConnectionRow(void* connectionRow); All Deletes a ConnectionRow object and its related ConnectionRowWrapper object.
void clear(void* connectionRow); All

Clears the contents of a ConnectionRow object and prepares the object for reuse. If the ConnectionRowType is owned by the given ConnectionRow, all data, including the type, is cleared. If the ConnectionRowType is not owned by the given ConnectionRow, only the internal data store is cleared and the type remains the same.

The ownership of a type is decided by the parameter own, located in the API setStreamType.

void clearData(void* connectionRow); All Clears all data from the internal data store of a ConnectionRow object, leaving only the stream information.
void* createNew(void* connectionRow); All Creates a new ConnectionRow object of the same subtype as the one specified.
void setDateFormat(void* connectionRow, const char *fmt); All Sets the date format using a representative string.
void setTimestampFormat(void* connectionRow, const char *fmt); All Sets the timestamp format using a representative string.
void setStreamName(void* connectionRow, const char *sname); All Specifies a unique name for the stream.
const char* getStreamName(void* connectionRow); All Retrieves the name of the given stream.
void setStreamType(void* connectionRow, void *connectionRowType, bool own); All Specifies a preparsed stream type and sends stream row definition information contained in the ConnectionRowType object to the ConnectionRow object. To apply the row schema, the ESP Server calls this API after the ConnectionRow object is created.

The own parameter specifies ownership of a type object and therefore deletion responsibility, as seen in the clear API.

void *getStreamType(void* connectionRow); All Retrieves stream row definition information contained in the ConnectionRowType object.
bool getFieldAsStringWithKey(void *connectionRow, const char *fname, const char **val); RowByName Retrieves a column value from the ConnectionRow object using the given column name.
bool setFieldAsStringWithKey(void *connectionRow, const char *fname, const char* val); RowByName Updates the value of the column with the specified name, or creates a new column with the specified name and value.
bool getFieldAsStringWithIndex(void *connectionRow, int fn, const char **val); RowByOrder Retrieves a column value from the ConnectionRow object using the column index.
bool setFieldAsStringWithIndex(void* connectionRow, int fn, const char *val); RowByOrder References a column index and updates or appends the relevant column.
bool appendFieldAsString(void* connectionRow, const char *val); RowByOrder Appends a new column to the given ConnectionRow object and populates it with the given value.
char getOp(void* connectionRow ); RowByOrder Retrieves operation type information.
void setOp(void* connectionRow, char op); RowByOrder Sets the operation type of the ConnectionRow object. Valid values are:
  • i or I (insert)
  • d or D (delete)
  • u or U (update)
  • p or P (upsert)
const char *getFlagsAsString(void* connectionRow); RowByOrder Retrieves flag information in string format.
bool setFlagsAsString(void* connectionRow, const char * flags); RowByOrder Sets up the flag information in string format and subscribes with shine through, if possible. Therefore, when an update contains no new data for previously received fields, information for those fields is retained.
int size(void* connectionRow); RowByOrder Determines the number of existing fields.
void* toRow(void* connectionRow, size_t rowNo, void* connectionErrorMsgs); All Converts an existing ConnectionRow into an ESP StreamRow.
bool fromRow(void* connectionRow, void* streamRow, size_t rowNo, void* connectionErrorMsgs); All Converts an existing ESP StreamRow into a ConnectionRow.