Zserio C++ runtime library  1.0.2
Built for Zserio 2.14.1
zserio::ValidationSqliteUtil< ALLOC > Struct Template Reference

#include <ValidationSqliteUtil.h>

Classes

struct  ColumnDescription
 

Public Types

using string_type = string< ALLOC >
 
using Statement = std::unique_ptr< sqlite3_stmt, SqliteFinalizer >
 
using TableSchema = std::map< string_type, ColumnDescription, std::less< string_type >, RebindAlloc< ALLOC, std::pair< const string_type, ColumnDescription > >>
 

Static Public Member Functions

static size_t getNumberOfTableRows (SqliteConnection &connection, StringView attachedDbName, StringView tableName, const ALLOC &allocator)
 
static void getTableSchema (SqliteConnection &connection, StringView attachedDbName, StringView tableName, TableSchema &tableSchema, const ALLOC &allocator)
 
static bool isColumnInTable (SqliteConnection &connection, StringView attachedDbName, StringView tableName, StringView columnName, const ALLOC &allocator)
 
static const char * sqliteColumnTypeName (int columnType)
 

Detailed Description

template<typename ALLOC>
struct zserio::ValidationSqliteUtil< ALLOC >

Sqlite utility for validation.

Definition at line 17 of file ValidationSqliteUtil.h.

Member Typedef Documentation

◆ Statement

template<typename ALLOC >
using zserio::ValidationSqliteUtil< ALLOC >::Statement = std::unique_ptr<sqlite3_stmt, SqliteFinalizer>

Definition at line 20 of file ValidationSqliteUtil.h.

◆ string_type

template<typename ALLOC >
using zserio::ValidationSqliteUtil< ALLOC >::string_type = string<ALLOC>

Definition at line 19 of file ValidationSqliteUtil.h.

◆ TableSchema

template<typename ALLOC >
using zserio::ValidationSqliteUtil< ALLOC >::TableSchema = std::map<string_type, ColumnDescription, std::less<string_type>, RebindAlloc<ALLOC, std::pair<const string_type, ColumnDescription> >>

Definition at line 33 of file ValidationSqliteUtil.h.

Member Function Documentation

◆ getNumberOfTableRows()

template<typename ALLOC >
static size_t zserio::ValidationSqliteUtil< ALLOC >::getNumberOfTableRows ( SqliteConnection connection,
StringView  attachedDbName,
StringView  tableName,
const ALLOC &  allocator 
)
inlinestatic

Gets number of rows in the given SQLite table.

Parameters
connectionDatabase connection to use.
attachedDbNameAttached database name if table is relocated in different database.
tableNameName of the table to get column types of.
allocatorAllocator to use for the query string composition.
Returns
Number of rows.
Exceptions
SqliteExceptionif the table does not exist.

Definition at line 48 of file ValidationSqliteUtil.h.

◆ getTableSchema()

template<typename ALLOC >
static void zserio::ValidationSqliteUtil< ALLOC >::getTableSchema ( SqliteConnection connection,
StringView  attachedDbName,
StringView  tableName,
TableSchema tableSchema,
const ALLOC &  allocator 
)
inlinestatic

Gets a map of column names to column description for given SQLite table.

Parameters
connectionDatabase connection to use.
attachedDbNameAttached database name if table is relocated in different database.
tableNameName of the table to get column types of.
tableSchemaSchema to fill.
allocatorAllocator to use for the query string composition.

Definition at line 80 of file ValidationSqliteUtil.h.

◆ isColumnInTable()

template<typename ALLOC >
static bool zserio::ValidationSqliteUtil< ALLOC >::isColumnInTable ( SqliteConnection connection,
StringView  attachedDbName,
StringView  tableName,
StringView  columnName,
const ALLOC &  allocator 
)
inlinestatic

Check if the column is present in the given SQLite table. Note that this method also detect hidden SQLite columns, which are not visible using standard PRAGMA table_info query.

Parameters
connectionDatabase connection to use.
attachedDbNameAttached database name if table is relocated in different database.
tableNameName of the table to get column types of.
columnNameName of the column to check.
allocatorAllocator to use for the query string composition.
Returns
Returns true if the column is present in the table, even if the column is hidden. Otherwise returns false.

Definition at line 131 of file ValidationSqliteUtil.h.

◆ sqliteColumnTypeName()

template<typename ALLOC >
static const char* zserio::ValidationSqliteUtil< ALLOC >::sqliteColumnTypeName ( int  columnType)
inlinestatic

Gets name of the given SQLite column type.

Parameters
columnTypeSQLite column type.
Returns
SQLite column type name.

Definition at line 165 of file ValidationSqliteUtil.h.


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