Zserio C++ runtime library  1.2.0
Built for Zserio 2.16.0
zserio::IValidationObserver Class Referenceabstract

#include <IValidationObserver.h>

Public Types

enum  ErrorType {
  INVALID_COLUMN_TYPE , INVALID_COLUMN_CONSTRAINT , COLUMN_MISSING , COLUMN_SUPERFLUOUS ,
  VALUE_OUT_OF_RANGE , INVALID_VALUE , BLOB_PARSE_FAILED , BLOB_COMPARE_FAILED
}
 

Public Member Functions

virtual ~IValidationObserver ()=default
 
virtual void beginDatabase (size_t numberOfTables)=0
 
virtual void endDatabase (size_t numberOfValidatedTables)=0
 
virtual bool beginTable (StringView tableName, size_t numberOfRows)=0
 
virtual bool endTable (StringView tableName, size_t numberOfValidatedRows)=0
 
virtual bool reportError (StringView tableName, StringView fieldName, Span< const StringView > primaryKeyValues, ErrorType errorType, StringView message)=0
 

Detailed Description

Observer interface for validation.

Definition at line 14 of file IValidationObserver.h.

Member Enumeration Documentation

◆ ErrorType

Defines types of validation errors.

Enumerator
INVALID_COLUMN_TYPE 

The column type in SQL table is different from definition in zserio.

INVALID_COLUMN_CONSTRAINT 

The column constraint in SQL table is different from definition in zserio.

COLUMN_MISSING 

The column is defined in zserio but it is not in SQL table.

COLUMN_SUPERFLUOUS 

The column is not defined in zserio but it is in SQL table.

VALUE_OUT_OF_RANGE 

Value in SQL table is out of range according to the definition in zserio.

INVALID_VALUE 

Value in SQL table is invalid according to the definition in zserio.

BLOB_PARSE_FAILED 

Parsing of read blob from SQL table failed.

BLOB_COMPARE_FAILED 

Comparing of read blob from SQL table to parsed blob written in bit stream failed.

Definition at line 56 of file IValidationObserver.h.

Constructor & Destructor Documentation

◆ ~IValidationObserver()

virtual zserio::IValidationObserver::~IValidationObserver ( )
virtualdefault

Member Function Documentation

◆ beginDatabase()

virtual void zserio::IValidationObserver::beginDatabase ( size_t  numberOfTables)
pure virtual

Called before the database is validated.

Parameters
numberOfTablesNumber of tables in the database.

◆ beginTable()

virtual bool zserio::IValidationObserver::beginTable ( StringView  tableName,
size_t  numberOfRows 
)
pure virtual

Called just before the table with tableName is validated.

Parameters
tableNameName of the table which is going to be validated.
numberOfRowsNumber of rows in the table.
Returns
True to validate the table, false to skip the table.

◆ endDatabase()

virtual void zserio::IValidationObserver::endDatabase ( size_t  numberOfValidatedTables)
pure virtual

Called after the database is validated.

Parameters
numberOfValidatedTablesNumber of tables which were validated.

◆ endTable()

virtual bool zserio::IValidationObserver::endTable ( StringView  tableName,
size_t  numberOfValidatedRows 
)
pure virtual

Called after the table with tableName validation is finished.

Parameters
tableNameName of to the validated table.
numberOfValidatedRowsNumber of validated rows.
Returns
True to continue validation, false to stop the whole validation.

◆ reportError()

virtual bool zserio::IValidationObserver::reportError ( StringView  tableName,
StringView  fieldName,
Span< const StringView primaryKeyValues,
ErrorType  errorType,
StringView  message 
)
pure virtual

Called when an error is detected.

Parameters
tableNameName of the table where the validation error occurred.
fieldNameName of the column where the validation error occurred.
primaryKeyValuesValues of the primary key to identify the row where the validation error occurred.
Note
When the table has no primary key, rowid is used.
Returns
True to continue validation, false to skip validation of the rest of the current table.

The documentation for this class was generated from the following file: