myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
tinysql::Catalog Class Reference

All table definitions, read from the SYSTEM_TABLE file (one 80-character line per column). More...

#include <Catalog.hpp>

Public Member Functions

const TableSchema & table (std::string_view name) const
 Finds a table by name.
 
const std::vector< TableSchema > & tables () const
 All tables, in the order they appear in SYSTEM_TABLE.
 
std::filesystem::path dataFile (const TableSchema &table) const
 The file holding a table's rows.
 

Static Public Member Functions

static Catalog load (const std::filesystem::path &dataDir)
 Reads SYSTEM_TABLE from a data directory.
 

Private Attributes

std::filesystem::path dataDir_
 Where the files are.
 
std::vector< TableSchema > tables_
 Every table, in file order.
 

Detailed Description

All table definitions, read from the SYSTEM_TABLE file (one 80-character line per column).

Definition at line 47 of file Catalog.hpp.

Member Function Documentation

◆ dataFile()

std::filesystem::path tinysql::Catalog::dataFile ( const TableSchema &  table) const

The file holding a table's rows.

Parameters
tableThe table.
Returns
SYSTEM_TABLE for the catalogue itself; <name>_DATA for every other table.

Definition at line 125 of file Catalog.cpp.

◆ load()

Catalog tinysql::Catalog::load ( const std::filesystem::path &  dataDir)
static

Reads SYSTEM_TABLE from a data directory.

Parameters
dataDirThe directory holding SYSTEM_TABLE and the data files.
Returns
The catalogue with every table it defines.
Exceptions
SqlErrorIf the file cannot be opened or a line is malformed.

Definition at line 74 of file Catalog.cpp.

◆ table()

const TableSchema & tinysql::Catalog::table ( std::string_view  name) const

Finds a table by name.

Parameters
nameThe table name (case-insensitive).
Returns
The table's definition.
Exceptions
SqlErrorIf there is no such table.

Definition at line 116 of file Catalog.cpp.

◆ tables()

const std::vector< TableSchema > & tinysql::Catalog::tables ( ) const
inline

All tables, in the order they appear in SYSTEM_TABLE.

Returns
The table definitions.

Definition at line 63 of file Catalog.hpp.

Member Data Documentation

◆ dataDir_

std::filesystem::path tinysql::Catalog::dataDir_
private

Where the files are.

Definition at line 71 of file Catalog.hpp.

◆ tables_

std::vector<TableSchema> tinysql::Catalog::tables_
private

Every table, in file order.

Definition at line 72 of file Catalog.hpp.


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