#ifndef TABLE_BUILDER_H #define TABLE_BUILDER_H #include "core/ustring.h" #include "core/object/reference.h" class QueryResult; class TableBuilder : public Reference { GDCLASS(TableBuilder, Reference); public: String get_result(); void set_result(const String &val); virtual TableBuilder *create_table(const String &name); virtual TableBuilder *integer(const String &name, const int length = -1); virtual TableBuilder *tiny_integer(const String &name, const int length = -1); virtual TableBuilder *small_integer(const String &name, const int length = -1); virtual TableBuilder *real_float(const String &name, const int size = -1, const int d = -1); virtual TableBuilder *real_double(const String &name, const int size = -1, const int d = -1); virtual TableBuilder *date(const String &name); virtual TableBuilder *varchar(const String &name, const int length = -1); virtual TableBuilder *text(const String &name); virtual TableBuilder *not_null(); virtual TableBuilder *null(); virtual TableBuilder *defval(const String &val); virtual TableBuilder *auto_increment(); virtual TableBuilder *primary_key(const String &name = ""); virtual TableBuilder *next_row(); virtual TableBuilder *ccreate_table(); virtual TableBuilder *drop_table_if_exists(); virtual TableBuilder *drop_table(const String &name = ""); virtual TableBuilder *drop_table_if_exists(const String &name); virtual TableBuilder *cdrop_table(); virtual TableBuilder *foreign_key(const String &name); virtual TableBuilder *references(const String &table, const String &name); virtual Ref run(); virtual void run_query(); void print(); TableBuilder(); virtual ~TableBuilder(); String result; protected: static void _bind_methods(); Ref _create_table_bind(const String &name); Ref _integer_bind(const String &name, const int length = -1); Ref _tiny_integer_bind(const String &name, const int length = -1); Ref _small_integer_bind(const String &name, const int length = -1); Ref _real_float_bind(const String &name, const int size = -1, const int d = -1); Ref _real_double_bind(const String &name, const int size = -1, const int d = -1); Ref _date_bind(const String &name); Ref _varchar_bind(const String &name, const int length = -1); Ref _text_bind(const String &name); Ref _not_null_bind(); Ref _null_bind(); Ref _defval_bind(const String &val); Ref _auto_increment_bind(); Ref _primary_key_bind(const String &name = ""); Ref _next_row_bind(); Ref _ccreate_table_bind(); Ref _drop_table_bind(const String &name = ""); Ref _drop_table_if_exists_bind(const String &name); Ref _cdrop_table_bind(); Ref _foreign_key_bind(const String &name); Ref _references_bind(const String &table, const String &name); }; #endif