2021-08-19 22:24:16 +02:00
|
|
|
#ifndef SQLITE3_TABLE_BUILDER_H
|
|
|
|
#define SQLITE3_TABLE_BUILDER_H
|
|
|
|
|
2021-11-01 17:49:10 +01:00
|
|
|
#include "core/string.h"
|
2021-08-19 22:24:16 +02:00
|
|
|
|
2022-02-05 15:57:40 +01:00
|
|
|
#include "database/table_builder.h"
|
2021-08-19 22:24:16 +02:00
|
|
|
|
2021-08-19 23:55:16 +02:00
|
|
|
class SQLite3Database;
|
|
|
|
|
2021-08-19 22:24:16 +02:00
|
|
|
class SQLite3TableBuilder : public TableBuilder {
|
2022-01-08 10:04:12 +01:00
|
|
|
RCPP_OBJECT(SQLite3TableBuilder, TableBuilder);
|
|
|
|
|
2021-08-19 22:24:16 +02:00
|
|
|
public:
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *create_table(const String &name);
|
2021-11-14 13:56:25 +01:00
|
|
|
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *integer(const String &name);
|
2021-11-14 13:56:25 +01:00
|
|
|
TableBuilder *integer(const String &name, const int length);
|
|
|
|
|
|
|
|
TableBuilder *tiny_integer(const String &name);
|
|
|
|
TableBuilder *tiny_integer(const String &name, const int length);
|
|
|
|
|
2021-11-14 16:52:09 +01:00
|
|
|
TableBuilder *small_integer(const String &name);
|
|
|
|
TableBuilder *small_integer(const String &name, const int length);
|
|
|
|
|
|
|
|
TableBuilder *real_float(const String &name);
|
|
|
|
TableBuilder *real_float(const String &name, const int size, const int d);
|
|
|
|
|
|
|
|
TableBuilder *real_double(const String &name);
|
|
|
|
TableBuilder *real_double(const String &name, const int size, const int d);
|
|
|
|
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *date(const String &name);
|
2021-11-20 01:39:52 +01:00
|
|
|
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *varchar(const String &name, const int length);
|
2021-11-20 01:39:52 +01:00
|
|
|
TableBuilder *text(const String &name);
|
|
|
|
|
2021-08-19 22:24:16 +02:00
|
|
|
TableBuilder *not_null();
|
|
|
|
TableBuilder *null();
|
2021-11-14 13:56:25 +01:00
|
|
|
TableBuilder *defval(const String &val);
|
2021-08-19 22:24:16 +02:00
|
|
|
TableBuilder *auto_increment();
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *primary_key(const String &name);
|
2021-08-19 22:24:16 +02:00
|
|
|
TableBuilder *primary_key();
|
|
|
|
TableBuilder *next_row();
|
2021-08-19 23:55:16 +02:00
|
|
|
TableBuilder *ccreate_table();
|
2021-08-19 22:24:16 +02:00
|
|
|
|
2021-08-19 23:55:16 +02:00
|
|
|
TableBuilder *drop_table();
|
|
|
|
TableBuilder *drop_table_if_exists();
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *drop_table(const String &name);
|
|
|
|
TableBuilder *drop_table_if_exists(const String &name);
|
2021-08-19 23:55:16 +02:00
|
|
|
TableBuilder *cdrop_table();
|
|
|
|
|
2021-11-01 17:49:10 +01:00
|
|
|
TableBuilder *foreign_key(const String &name);
|
|
|
|
TableBuilder *references(const String &table, const String &name);
|
2021-08-19 22:24:16 +02:00
|
|
|
|
2021-11-01 16:57:22 +01:00
|
|
|
virtual Ref<QueryResult> run();
|
2021-08-19 23:55:16 +02:00
|
|
|
virtual void run_query();
|
2021-08-19 22:24:16 +02:00
|
|
|
|
|
|
|
SQLite3TableBuilder();
|
|
|
|
virtual ~SQLite3TableBuilder();
|
2021-08-19 23:55:16 +02:00
|
|
|
|
|
|
|
SQLite3Database *_db;
|
2021-08-19 22:24:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|