2020-12-01 23:37:10 +01:00
|
|
|
#ifndef TABLE_BUILDER_H
|
|
|
|
#define TABLE_BUILDER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2021-08-22 20:41:59 +02:00
|
|
|
#include "core/reference.h"
|
|
|
|
|
2021-08-19 23:55:16 +02:00
|
|
|
class QueryResult;
|
|
|
|
|
2021-08-22 20:41:59 +02:00
|
|
|
class TableBuilder : public Reference {
|
2020-12-01 23:37:10 +01:00
|
|
|
public:
|
|
|
|
virtual TableBuilder *create_table(const std::string &name);
|
|
|
|
virtual TableBuilder *integer(const std::string &name);
|
|
|
|
virtual TableBuilder *date(const std::string &name);
|
|
|
|
virtual TableBuilder *varchar(const std::string &name, const int length);
|
|
|
|
virtual TableBuilder *not_null();
|
|
|
|
virtual TableBuilder *null();
|
|
|
|
virtual TableBuilder *auto_increment();
|
|
|
|
virtual TableBuilder *primary_key(const std::string &name);
|
|
|
|
virtual TableBuilder *primary_key();
|
|
|
|
virtual TableBuilder *next_row();
|
2021-08-19 23:55:16 +02:00
|
|
|
virtual TableBuilder *ccreate_table();
|
2020-12-01 23:37:10 +01:00
|
|
|
|
2021-08-19 23:55:16 +02:00
|
|
|
virtual TableBuilder *drop_table();
|
|
|
|
virtual TableBuilder *drop_table_if_exists();
|
2020-12-02 00:49:17 +01:00
|
|
|
virtual TableBuilder *drop_table(const std::string &name);
|
2021-08-19 23:55:16 +02:00
|
|
|
virtual TableBuilder *drop_table_if_exists(const std::string &name);
|
|
|
|
virtual TableBuilder *cdrop_table();
|
|
|
|
|
|
|
|
virtual TableBuilder *foreign_key(const std::string &name);
|
|
|
|
virtual TableBuilder *references(const std::string &table, const std::string &name);
|
|
|
|
|
|
|
|
virtual QueryResult *run();
|
|
|
|
virtual void run_query();
|
2020-12-02 00:49:17 +01:00
|
|
|
|
2021-08-19 23:55:16 +02:00
|
|
|
void print();
|
2020-12-01 23:37:10 +01:00
|
|
|
|
|
|
|
TableBuilder();
|
|
|
|
virtual ~TableBuilder();
|
|
|
|
|
|
|
|
std::string result;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|