Added smallint, float, and double types to the TableBuilder.

This commit is contained in:
Relintai 2021-11-14 16:52:09 +01:00
parent ad632993d0
commit 1ec66db3c7
4 changed files with 74 additions and 1 deletions

View File

@ -21,6 +21,27 @@ TableBuilder *TableBuilder::tiny_integer(const String &name, const int length) {
return this;
}
TableBuilder *TableBuilder::small_integer(const String &name) {
return this;
}
TableBuilder *TableBuilder::small_integer(const String &name, const int length) {
return this;
}
TableBuilder *TableBuilder::real_float(const String &name) {
return this;
}
TableBuilder *TableBuilder::real_float(const String &name, const int size, const int d) {
return this;
}
TableBuilder *TableBuilder::real_double(const String &name) {
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;
}

View File

@ -17,6 +17,15 @@ public:
virtual TableBuilder *tiny_integer(const String &name);
virtual TableBuilder *tiny_integer(const String &name, const int length);
virtual TableBuilder *small_integer(const String &name);
virtual TableBuilder *small_integer(const String &name, const int length);
virtual TableBuilder *real_float(const String &name);
virtual TableBuilder *real_float(const String &name, const int size, const int d);
virtual TableBuilder *real_double(const String &name);
virtual TableBuilder *real_double(const String &name, const int size, const int d);
virtual TableBuilder *date(const String &name);
virtual TableBuilder *varchar(const String &name, const int length);
virtual TableBuilder *not_null();

View File

@ -24,7 +24,7 @@ TableBuilder *SQLite3TableBuilder::integer(const String &name, const int length)
}
TableBuilder *SQLite3TableBuilder::tiny_integer(const String &name) {
result += name + " INTEGER ";
result += name + " INTEGER(4) ";
return this;
}
@ -33,6 +33,40 @@ TableBuilder *SQLite3TableBuilder::tiny_integer(const String &name, const int le
result += String::num(length);
result += ") ";
return this;
}
TableBuilder *SQLite3TableBuilder::small_integer(const String &name) {
result += name + " INTEGER(6) ";
return this;
}
TableBuilder *SQLite3TableBuilder::small_integer(const String &name, const int length) {
result += name + " INTEGER(";
result += String::num(length);
result += ") ";
return this;
}
TableBuilder *SQLite3TableBuilder::real_float(const String &name) {
result += name + " FLOAT ";
return this;
}
TableBuilder *SQLite3TableBuilder::real_float(const String &name, const int size, const int d) {
result += name + " FLOAT ";
return this;
}
TableBuilder *SQLite3TableBuilder::real_double(const String &name) {
result += name + " DOUBLE ";
return this;
}
TableBuilder *SQLite3TableBuilder::real_double(const String &name, const int size, const int d) {
result += name + " DOUBLE ";
return this;
}

View File

@ -17,6 +17,15 @@ public:
TableBuilder *tiny_integer(const String &name);
TableBuilder *tiny_integer(const String &name, const int length);
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);
TableBuilder *date(const String &name);
TableBuilder *varchar(const String &name, const int length);
TableBuilder *not_null();