public DatabaseTableField(string n, DatabaseTableFieldType t, bool pk = false, bool ai = false, bool nn = false, bool u = false) { name = n.StyleAsEntity(); field_type = t; is_primary_key = pk; is_auto_increment = ai; is_not_null = nn; is_unique = u; }
static public Type GetSystemType(this DatabaseTableFieldType item) { switch (item) { case DatabaseTableFieldType.NULL: return(null); case DatabaseTableFieldType.INTEGER: return(typeof(long)); case DatabaseTableFieldType.REAL: return(typeof(decimal)); case DatabaseTableFieldType.TEXT: return(typeof(string)); case DatabaseTableFieldType.BLOB: return(typeof(byte[])); } throw new UnaccountedBranchException("item", item); }
static public DatabaseTableField NewFieldPrimaryKey(this DatabaseTable item, DatabaseTableFieldType t = DatabaseTableFieldType.INTEGER, bool ai = true) { return(item.AddField(new DatabaseTableField_PrimaryKey(t, ai))); }
static public DatabaseTableField NewFieldForeignKey(this DatabaseTable item, string n, DatabaseTable t, DatabaseTableFieldType ft = DatabaseTableFieldType.INTEGER, bool nn = false) { return(item.AddField(new DatabaseTableField_ForeignKey(n, t, ft, nn))); }
static public DatabaseTableField NewFieldNormal(this DatabaseTable item, string n, DatabaseTableFieldType t, bool nn = false, bool u = false) { return(item.AddField(new DatabaseTableField_Normal(n, t, nn, u))); }
public DatabaseTableField_Normal(string n, DatabaseTableFieldType t, bool nn = false, bool u = false) : base(n, t, false, false, nn, u) { }
public DatabaseTableField_PrimaryKey(DatabaseTableFieldType t = DatabaseTableFieldType.INTEGER, bool ai = true) : base("id", t, true, ai, false, true) { }
public DatabaseTableField_ForeignKey(string n, DatabaseTable t, DatabaseTableFieldType ft = DatabaseTableFieldType.INTEGER, bool nn = false) : base(n, ft, false, false, nn, false) { foreign_table = t; }