23#define M_FUNCTION(NAME, KIND) { \
24 auto name = pool(#NAME); \
25 auto res = standard_functions_.emplace(name, new Function(name, Function::FN_ ## NAME, Function::KIND)); \
26 M_insist(res.second, "function already defined"); \
28#include <mutable/tables/Functions.tbl>
61 if (it !=
databases_.end())
throw std::invalid_argument(
"database with that name already exist");
69 throw std::invalid_argument(
"Cannot drop database; currently in use.");
72 throw std::invalid_argument(
"Database of that name does not exist.");
78static
void add_catalog_args()
88 [&C] (
const char *str) {
91 }
catch (std::invalid_argument) {
92 std::cerr <<
"There is no data layout with the name \"" << str <<
"\".\n";
93 std::exit(EXIT_FAILURE);
100 "--cardinality-estimator",
101 "cardinality estimator to use",
102 [&C] (
const char *str) {
105 }
catch (std::invalid_argument) {
106 std::cerr <<
"There is no cardinality estimator with the name \"" << str <<
"\".\n";
107 std::exit(EXIT_FAILURE);
115 "plan enumerator to use",
116 [&C] (
const char *str) {
119 }
catch (std::invalid_argument) {
120 std::cerr <<
"There is no plan enumerator with the name \"" << str <<
"\".\n";
121 std::exit(EXIT_FAILURE);
129 "execution backend to use",
130 [&C] (
const char *str) {
133 }
catch (std::invalid_argument) {
134 std::cerr <<
"There is no execution backend with the name \"" << str <<
"\".\n";
135 std::exit(EXIT_FAILURE);
143 "query scheduler to use",
144 [&C] (
const char *str) {
147 }
catch (std::invalid_argument) {
148 std::cerr <<
"There is no query scheduler with the name \"" << str <<
"\".\n";
149 std::exit(EXIT_FAILURE);
__attribute__((constructor(202))) static void register_interpreter()
void add(const char *group_name, const char *short_name, const char *long_name, const char *description, Callback &&callback)
Adds a new group option to the ArgParser.
ThreadSafeStringPool::proxy_type ThreadSafePooledString
A simple linear allocator which keeps a global pointer to the next free memory address and advances i...
The catalog contains all Databases and keeps track of all meta information of the database system.
void default_cardinality_estimator(const ThreadSafePooledString &name)
Sets the default CardinalityEstimator to use.
std::unordered_map< ThreadSafePooledString, Function * > standard_functions_
functions defined by the SQL standard
Database & get_database_in_use()
Returns a reference to the Database that is currently in use, if any.
void default_data_layout(const ThreadSafePooledString &name)
Sets the default DataLayoutFactory to use.
bool has_database_in_use() const
Returns true if any Database is currently in use.
Database & add_database(ThreadSafePooledString name)
Creates a new Database with the given name.
ThreadSafePooledString pool(const char *str) const
Creates an internalized copy of the string str by adding it to the internal StringPool.
static Catalog & Get()
Return a reference to the single Catalog instance.
void drop_database(const ThreadSafePooledString &name)
Drops the Database with the name.
void default_scheduler(const ThreadSafePooledString &name)
Sets the default Scheduler to use.
void default_plan_enumerator(const ThreadSafePooledString &name)
Sets the default PlanEnumerator to use.
static Catalog * the_catalog_
Singleton Catalog instance.
m::ArgParser & arg_parser()
std::unordered_map< ThreadSafePooledString, Database * > databases_
the databases
void default_backend(const ThreadSafePooledString &name)
Sets the default Backend to use.
A Database is a set of Tables, Functions, and Statistics.