Player12
An open source football management simulator
Loading...
Searching...
No Matches
SQLLoader Class Reference

Utility class for loading SQL files and parsing queries. More...

#include <SQLLoader.h>

Static Public Member Functions

static void loadQueriesFromFile ()
 Load SQL file and parse queries.
 
static std::string loadSchemaFromFile ()
 Load database schema from file.
 
static const std::string & getQuery (const Query query)
 Get a query by its ID.
 

Private Member Functions

 SQLLoader ()=default
 

Static Private Member Functions

static std::string readFile (const std::string &filepath)
 
static void parseQueries (const std::string &content)
 
static std::string trim (const std::string &str)
 

Static Private Attributes

static std::unordered_map< Query, std::string > queries_ {}
 

Detailed Description

Utility class for loading SQL files and parsing queries.

Constructor & Destructor Documentation

◆ SQLLoader()

SQLLoader::SQLLoader ( )
privatedefault

Member Function Documentation

◆ getQuery()

const std::string & SQLLoader::getQuery ( const Query  query)
static

Get a query by its ID.

Parameters
queryThe identifier of the query to retrieve.
Returns
A constant reference to the query string.

◆ loadQueriesFromFile()

void SQLLoader::loadQueriesFromFile ( )
static

Load SQL file and parse queries.

◆ loadSchemaFromFile()

std::string SQLLoader::loadSchemaFromFile ( )
static

Load database schema from file.

Returns
A string containing the database schema.

◆ parseQueries()

void SQLLoader::parseQueries ( const std::string &  content)
staticprivate

◆ readFile()

std::string SQLLoader::readFile ( const std::string &  filepath)
staticprivate

◆ trim()

std::string SQLLoader::trim ( const std::string &  str)
staticprivate

Member Data Documentation

◆ queries_

std::unordered_map< Query, std::string > SQLLoader::queries_ {}
staticprivate

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