mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Added integer with length and a tinyinteger to TableBuilder.
This commit is contained in:
parent
a98480104e
commit
ad632993d0
@ -10,6 +10,17 @@ TableBuilder *TableBuilder::integer(const String &name) {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *TableBuilder::integer(const String &name, const int length) {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *TableBuilder::tiny_integer(const String &name) {
|
||||
return this;
|
||||
}
|
||||
TableBuilder *TableBuilder::tiny_integer(const String &name, const int length) {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *TableBuilder::date(const String &name) {
|
||||
return this;
|
||||
}
|
||||
@ -26,6 +37,10 @@ TableBuilder *TableBuilder::null() {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *TableBuilder::defval(const String &val) {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *TableBuilder::auto_increment() {
|
||||
return this;
|
||||
}
|
||||
|
@ -10,11 +10,18 @@ class QueryResult;
|
||||
class TableBuilder : public Reference {
|
||||
public:
|
||||
virtual TableBuilder *create_table(const String &name);
|
||||
|
||||
virtual TableBuilder *integer(const String &name);
|
||||
virtual TableBuilder *integer(const String &name, const int length);
|
||||
|
||||
virtual TableBuilder *tiny_integer(const String &name);
|
||||
virtual TableBuilder *tiny_integer(const String &name, const int length);
|
||||
|
||||
virtual TableBuilder *date(const String &name);
|
||||
virtual TableBuilder *varchar(const String &name, const int length);
|
||||
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 *primary_key();
|
||||
|
@ -13,6 +13,27 @@ TableBuilder *SQLite3TableBuilder::create_table(const String &name) {
|
||||
TableBuilder *SQLite3TableBuilder::integer(const String &name) {
|
||||
result += name + " INTEGER ";
|
||||
|
||||
return this;
|
||||
}
|
||||
TableBuilder *SQLite3TableBuilder::integer(const String &name, const int length) {
|
||||
result += name + " INTEGER(";
|
||||
result += String::num(length);
|
||||
result += ") ";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *SQLite3TableBuilder::tiny_integer(const String &name) {
|
||||
result += name + " INTEGER ";
|
||||
|
||||
return this;
|
||||
}
|
||||
TableBuilder *SQLite3TableBuilder::tiny_integer(const String &name, const int length) {
|
||||
result += name + " INTEGER(";
|
||||
result += String::num(length);
|
||||
result += ") ";
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -40,6 +61,14 @@ TableBuilder *SQLite3TableBuilder::null() {
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *SQLite3TableBuilder::defval(const String &val) {
|
||||
result += "DEFAULT '";
|
||||
result += val;
|
||||
result += "'";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
TableBuilder *SQLite3TableBuilder::auto_increment() {
|
||||
//result += "AUTO_INCREMENT ";
|
||||
|
||||
|
@ -10,11 +10,18 @@ class SQLite3Database;
|
||||
class SQLite3TableBuilder : public TableBuilder {
|
||||
public:
|
||||
TableBuilder *create_table(const String &name);
|
||||
|
||||
TableBuilder *integer(const String &name);
|
||||
TableBuilder *integer(const String &name, const int length);
|
||||
|
||||
TableBuilder *tiny_integer(const String &name);
|
||||
TableBuilder *tiny_integer(const String &name, const int length);
|
||||
|
||||
TableBuilder *date(const String &name);
|
||||
TableBuilder *varchar(const String &name, const int length);
|
||||
TableBuilder *not_null();
|
||||
TableBuilder *null();
|
||||
TableBuilder *defval(const String &val);
|
||||
TableBuilder *auto_increment();
|
||||
TableBuilder *primary_key(const String &name);
|
||||
TableBuilder *primary_key();
|
||||
|
Loading…
Reference in New Issue
Block a user