#include "table_builder.h" #include "core/string/print_string.h" #include "query_result.h" String TableBuilder::get_result() { return result; } void TableBuilder::set_result(const String &val) { result = val; } TableBuilder *TableBuilder::create_table(const String &name) { return this; } TableBuilder *TableBuilder::integer(const String &name, const int length) { return this; } TableBuilder *TableBuilder::tiny_integer(const String &name, const int length) { return this; } TableBuilder *TableBuilder::small_integer(const String &name, const int length) { return this; } TableBuilder *TableBuilder::real_float(const String &name, const int size, const int d) { return this; } TableBuilder *TableBuilder::real_double(const String &name, const int size, const int d) { return this; } TableBuilder *TableBuilder::date(const String &name) { return this; } TableBuilder *TableBuilder::varchar(const String &name, const int length) { return this; } TableBuilder *TableBuilder::text(const String &name) { return this; } TableBuilder *TableBuilder::not_null() { return this; } TableBuilder *TableBuilder::null() { return this; } TableBuilder *TableBuilder::defval(const String &val) { return this; } TableBuilder *TableBuilder::auto_increment() { return this; } TableBuilder *TableBuilder::primary_key(const String &name) { return this; } TableBuilder *TableBuilder::next_row() { return this; } TableBuilder *TableBuilder::ccreate_table() { return this; } TableBuilder *TableBuilder::drop_table_if_exists() { return this; } TableBuilder *TableBuilder::drop_table(const String &name) { return this; } TableBuilder *TableBuilder::drop_table_if_exists(const String &name) { return this; } TableBuilder *TableBuilder::cdrop_table() { return this; } TableBuilder *TableBuilder::foreign_key(const String &name) { return this; } TableBuilder *TableBuilder::references(const String &table, const String &name) { return this; } Ref TableBuilder::run() { return Ref(); } void TableBuilder::run_query() { } void TableBuilder::print() { //printf("%s\n", result.get_data()); print_error(result); } TableBuilder::TableBuilder() { } TableBuilder::~TableBuilder() { } void TableBuilder::_bind_methods() { ClassDB::bind_method(D_METHOD("get_result"), &TableBuilder::get_result); ClassDB::bind_method(D_METHOD("set_result", "value"), &TableBuilder::set_result); ADD_PROPERTY(PropertyInfo(Variant::STRING, "result"), "set_result", "get_result"); ClassDB::bind_method(D_METHOD("create_table", "value"), &TableBuilder::_create_table_bind); ClassDB::bind_method(D_METHOD("integer", "name", "length"), &TableBuilder::_integer_bind); ClassDB::bind_method(D_METHOD("tiny_integer", "name", "length"), &TableBuilder::_tiny_integer_bind, -1); ClassDB::bind_method(D_METHOD("small_integer", "name", "length"), &TableBuilder::_small_integer_bind, -1); ClassDB::bind_method(D_METHOD("real_float", "name", "size", "d"), &TableBuilder::_real_float_bind, -1, -1); ClassDB::bind_method(D_METHOD("real_double", "name", "size", "d"), &TableBuilder::_real_double_bind, -1, -1); ClassDB::bind_method(D_METHOD("date", "name"), &TableBuilder::_date_bind); ClassDB::bind_method(D_METHOD("varchar", "name", "length"), &TableBuilder::_varchar_bind, -1); ClassDB::bind_method(D_METHOD("text", "name"), &TableBuilder::_text_bind); ClassDB::bind_method(D_METHOD("not_null"), &TableBuilder::_not_null_bind); ClassDB::bind_method(D_METHOD("null"), &TableBuilder::_null_bind); ClassDB::bind_method(D_METHOD("defval", "val"), &TableBuilder::_defval_bind); ClassDB::bind_method(D_METHOD("auto_increment"), &TableBuilder::_auto_increment_bind); ClassDB::bind_method(D_METHOD("primary_key", "name"), &TableBuilder::_primary_key_bind, ""); ClassDB::bind_method(D_METHOD("next_row"), &TableBuilder::_next_row_bind); ClassDB::bind_method(D_METHOD("ccreate_table"), &TableBuilder::_ccreate_table_bind); ClassDB::bind_method(D_METHOD("drop_table", "name"), &TableBuilder::_drop_table_bind, ""); ClassDB::bind_method(D_METHOD("drop_table_if_exists", "name"), &TableBuilder::_drop_table_if_exists_bind, ""); ClassDB::bind_method(D_METHOD("cdrop_table"), &TableBuilder::_cdrop_table_bind); ClassDB::bind_method(D_METHOD("foreign_key", "name"), &TableBuilder::_foreign_key_bind); ClassDB::bind_method(D_METHOD("references", "table", "name"), &TableBuilder::_references_bind); ClassDB::bind_method(D_METHOD("run"), &TableBuilder::run); ClassDB::bind_method(D_METHOD("run_query"), &TableBuilder::run_query); } Ref TableBuilder::_create_table_bind(const String &name) { return Ref(create_table(name)); } Ref TableBuilder::_integer_bind(const String &name, const int length) { return Ref(integer(name, length)); } Ref TableBuilder::_tiny_integer_bind(const String &name, const int length) { return Ref(tiny_integer(name, length)); } Ref TableBuilder::_small_integer_bind(const String &name, const int length) { return Ref(small_integer(name, length)); } Ref TableBuilder::_real_float_bind(const String &name, const int size, const int d) { return Ref(real_float(name, size, d)); } Ref TableBuilder::_real_double_bind(const String &name, const int size, const int d) { return Ref(real_double(name, size, d)); } Ref TableBuilder::_date_bind(const String &name) { return Ref(date(name)); } Ref TableBuilder::_varchar_bind(const String &name, const int length) { return Ref(varchar(name, length)); } Ref TableBuilder::_text_bind(const String &name) { return Ref(text(name)); } Ref TableBuilder::_not_null_bind() { return Ref(not_null()); } Ref TableBuilder::_null_bind() { return Ref(null()); } Ref TableBuilder::_defval_bind(const String &val) { return Ref(defval(val)); } Ref TableBuilder::_auto_increment_bind() { return Ref(auto_increment()); } Ref TableBuilder::_primary_key_bind(const String &name) { return Ref(primary_key(name)); } Ref TableBuilder::_next_row_bind() { return Ref(next_row()); } Ref TableBuilder::_ccreate_table_bind() { return Ref(ccreate_table()); } Ref TableBuilder::_drop_table_bind(const String &name) { return Ref(drop_table(name)); } Ref TableBuilder::_drop_table_if_exists_bind(const String &name) { return Ref(drop_table_if_exists(name)); } Ref TableBuilder::_cdrop_table_bind() { return Ref(cdrop_table()); } Ref TableBuilder::_foreign_key_bind(const String &name) { return Ref(foreign_key(name)); } Ref TableBuilder::_references_bind(const String &table, const String &name) { return Ref(references(table, name)); }