public AField addField(string name, ABSTRACTDATATYPES type, int size, params ABSTRACTFIELDMODIFIERS[] modifiers) { AField newField = addField(name, type, size); if (modifiers != null) { ABSTRACTFIELDMODIFIERS[] fieldmod = new ABSTRACTFIELDMODIFIERS[modifiers.Length]; for (int i = 0; i < modifiers.Length; i++) { fieldmod[i] = modifiers[i]; } newField.modifiers = fieldmod; } return newField; }
public bool hasModifier(ABSTRACTFIELDMODIFIERS modifier) { if(this.modifiers != null) foreach (ABSTRACTFIELDMODIFIERS fm in this.modifiers) { if (fm == modifier) return true; } return false; }
public void addModifier(ABSTRACTFIELDMODIFIERS modifier) { System.Collections.ArrayList modList = new System.Collections.ArrayList(); if (this.modifiers == null) this.modifiers = new ABSTRACTFIELDMODIFIERS[]{}; foreach (ABSTRACTFIELDMODIFIERS i in this.modifiers) { modList.Add(i); } modList.Add(modifier); this.modifiers = new ABSTRACTFIELDMODIFIERS[modList.Count]; Array.Copy(modList.ToArray(), this.modifiers, modList.Count); }
public AField addField(string name, ABSTRACTFIELDMODIFIERS modifier, string foreignTable) { if (modifier != ABSTRACTFIELDMODIFIERS.ForeignKey) { throw (new Exception("Method tried to create a foreign key with the wrong modifier type.")); } else { AField nField = new AField(name, foreignTable); nField.modifiers = new ABSTRACTFIELDMODIFIERS[] { modifier }; nField.type = this._dbProvider.GetTableCache().getCachedTable(foreignTable).getPrimaryKey().type; nField.maxsize = this._dbProvider.GetTableCache().getCachedTable(foreignTable).getPrimaryKey().maxsize; this._fieldlist.Add(nField); return nField; } }
// These 2 addField implementations deal with foreign key support public AField addField(string name, ABSTRACTFIELDMODIFIERS modifier, ATable foreignTable) { return addField(name, modifier, foreignTable.name); }