xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
Xale::Execution::TableManager Class Reference

#include <TableManager.h>

Collaboration diagram for Xale::Execution::TableManager:
Collaboration graph

Public Member Functions

 TableManager (Xale::Storage::IStorageEngine &storage, Xale::Storage::IFileManager &fileManager)
 Constructor for TableManager.
Xale::DataStructure::TablecreateTable (const std::string &name)
 Creates a new table with the given name.
bool dropTable (const std::string &name)
 Drops the table with the given name.
Xale::DataStructure::TablegetTable (const std::string &name)
 Retrieves the table with the given name.
bool tableExists (const std::string &name) const
 Checks if a table with the given name exists.
std::vector< std::string > getTableNames () const
 Retrieves the names of all existing tables.
void saveAllTables ()
 Save all tables to disk File format: [4 bytes: table_count] For each table: [4 bytes: table_name_length] [N bytes: table_name] [4 bytes: table_data_length] [M bytes: table_data (serialized)].
void loadAllTables ()
 Load all tables from disk File format: [4 bytes: table_count] For each table: [4 bytes: table_name_length] [N bytes: table_name] [4 bytes: table_data_length] [M bytes: table_data (serialized)].

Constructor & Destructor Documentation

◆ TableManager()

Xale::Execution::TableManager::TableManager ( Xale::Storage::IStorageEngine & storage,
Xale::Storage::IFileManager & fileManager )

Constructor for TableManager.

Parameters
storageReference to the storage engine
fileManagerReference to the file manager

Member Function Documentation

◆ createTable()

Xale::DataStructure::Table * Xale::Execution::TableManager::createTable ( const std::string & name)

Creates a new table with the given name.

Parameters
nameName of the table to create
Returns
Pointer to the created Xale::DataStructure::Table, or nullptr if it already exists

◆ dropTable()

bool Xale::Execution::TableManager::dropTable ( const std::string & name)

Drops the table with the given name.

Parameters
nameName of the table to drop
Returns
True if the table was dropped, false if it did not exist

◆ getTable()

Xale::DataStructure::Table * Xale::Execution::TableManager::getTable ( const std::string & name)

Retrieves the table with the given name.

Parameters
nameName of the table to retrieve
Returns
Pointer to the Xale::DataStructure::Table, or nullptr if it does not exist

◆ getTableNames()

std::vector< std::string > Xale::Execution::TableManager::getTableNames ( ) const

Retrieves the names of all existing tables.

Returns
Vector of table names

◆ loadAllTables()

void Xale::Execution::TableManager::loadAllTables ( )

Load all tables from disk File format: [4 bytes: table_count] For each table: [4 bytes: table_name_length] [N bytes: table_name] [4 bytes: table_data_length] [M bytes: table_data (serialized)].

◆ saveAllTables()

void Xale::Execution::TableManager::saveAllTables ( )

Save all tables to disk File format: [4 bytes: table_count] For each table: [4 bytes: table_name_length] [N bytes: table_name] [4 bytes: table_data_length] [M bytes: table_data (serialized)].

◆ tableExists()

bool Xale::Execution::TableManager::tableExists ( const std::string & name) const

Checks if a table with the given name exists.

Parameters
nameName of the table to check
Returns
True if the table exists, false otherwise

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