Lightweight 0.20261105.1
Loading...
Searching...
No Matches
Lightweight::SqlCatalogQueries Struct Reference

SQL that reads a database's catalog, for a driver without catalog functions (Driver::HasCatalogFunctions). More...

#include <SqlQueryFormatter.hpp>

Public Attributes

std::string_view defaultSchema
 The schema read when none is named.
 
std::string_view schemaNamed
 
std::string_view tables
 
std::string_view tablesLike
 
std::string_view searchPatternEscape
 The escape character of tablesLike's pattern.
 
std::string_view columns
 
std::string_view statistics
 
std::string_view uniqueStatistics
 As statistics, unique indexes only.
 
std::string_view foreignKeysTo
 
std::string_view primaryKeyColumns
 
std::string_view outgoingForeignKeys
 

Detailed Description

SQL that reads a database's catalog, for a driver without catalog functions (Driver::HasCatalogFunctions).

Each text is one statement; its parameters are bound as text; columns are read by position. The tables, statistics and foreign-key texts return the result-set layouts of ODBC's SQLTables, SQLStatistics and SQLForeignKeys, so that SqlSchema reads them with the readers of the ODBC path.

Every text reads one schema: the one named, else defaultSchema. Where SQL takes the schema as a value it is a parameter; where it takes it as an identifier, the text holds {0}, replaced by the schema's name quoted by SqlQueryFormatter::QuoteIdentifier before the text is prepared. A name is never spliced in any other way.

Definition at line 33 of file SqlQueryFormatter.hpp.

Member Data Documentation

◆ defaultSchema

std::string_view Lightweight::SqlCatalogQueries::defaultSchema

The schema read when none is named.

Definition at line 36 of file SqlQueryFormatter.hpp.

◆ schemaNamed

std::string_view Lightweight::SqlCatalogQueries::schemaNamed

The schema of one name, when the connection has a schema of that name: one row, 1 name; none otherwise. One parameter: the name. A schema that is not there holds no table.

Definition at line 39 of file SqlQueryFormatter.hpp.

◆ tables

std::string_view Lightweight::SqlCatalogQueries::tables

The user tables of the schema, no views, in SQLTables' layout: 1 TABLE_CAT, 2 TABLE_SCHEM, 3 TABLE_NAME, 4 TABLE_TYPE ('TABLE'), 5 REMARKS. No parameter; the schema as {0}.

Definition at line 42 of file SqlQueryFormatter.hpp.

◆ tablesLike

std::string_view Lightweight::SqlCatalogQueries::tablesLike

As tables, narrowed to the names matching one LIKE pattern escaped with searchPatternEscape. One parameter: the pattern; the schema as {0}.

Definition at line 45 of file SqlQueryFormatter.hpp.

◆ searchPatternEscape

std::string_view Lightweight::SqlCatalogQueries::searchPatternEscape

The escape character of tablesLike's pattern.

Definition at line 47 of file SqlQueryFormatter.hpp.

◆ columns

std::string_view Lightweight::SqlCatalogQueries::columns

The columns of one table, in declaration order, without generated or hidden columns: 1 name, 2 declared type (text, empty for none), 3 not null (0/1), 4 default value (SQL text or NULL), 5 position in the primary key (0 for none). Two parameters: the table name and the schema.

Definition at line 51 of file SqlQueryFormatter.hpp.

◆ statistics

std::string_view Lightweight::SqlCatalogQueries::statistics

The index columns of one table in SQLStatistics' layout (13 columns; 4 NON_UNIQUE, 6 INDEX_NAME, 7 TYPE = 3, 8 ORDINAL_POSITION 1-based, 9 COLUMN_NAME, NULL for an expression). Two parameters: the table name and the schema.

Definition at line 55 of file SqlQueryFormatter.hpp.

◆ uniqueStatistics

std::string_view Lightweight::SqlCatalogQueries::uniqueStatistics

As statistics, unique indexes only.

Definition at line 57 of file SqlQueryFormatter.hpp.

◆ foreignKeysTo

std::string_view Lightweight::SqlCatalogQueries::foreignKeysTo

The foreign keys referencing one table, from every table, in SQLForeignKeys' layout (14 columns; 3 PKTABLE_NAME as the constraint spells it, 4 PKCOLUMN_NAME, 7 FKTABLE_NAME, 8 FKCOLUMN_NAME, 9 KEY_SEQ 1-based, 12 FK_NAME = the constraint's id within its table). Two parameters: the referenced table name, matched case-insensitively, and the schema; the schema also as {0}.

Definition at line 62 of file SqlQueryFormatter.hpp.

◆ primaryKeyColumns

std::string_view Lightweight::SqlCatalogQueries::primaryKeyColumns

The columns of one table with their position in the primary key, in the layout of SQLite's PRAGMA table_info: 1 cid, 2 name, 3 type, 4 notnull, 5 dflt_value, 6 pk (1-based position in the primary key, 0 for none). Two parameters: the table name and the schema.

Definition at line 66 of file SqlQueryFormatter.hpp.

◆ outgoingForeignKeys

std::string_view Lightweight::SqlCatalogQueries::outgoingForeignKeys

The foreign keys of one table, one row per key column, in the layout of SQLite's PRAGMA foreign_key_list: 1 id (the constraint's id within its table), 2 seq (0-based), 3 table (the referenced table as the constraint spells it), 4 from, 5 to (NULL for the referenced primary key), 6 on_update, 7 on_delete, 8 match. Two parameters: the table name and the schema.

Definition at line 71 of file SqlQueryFormatter.hpp.


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