public DBTableField[] TableFields() { DBTableField _tableField; System.Collections.Generic.List <DBTableField> _list = new System.Collections.Generic.List <DBTableField>(); for (int a = 0; a < AttributeCollection.Count; a++) { switch (AttributeCollection[a].Name) { case "attributes": #region _list.Add( ... ); for (int c = 0; c < AttributeCollection[a].CompositeCollection.Count; c++) { switch (AttributeCollection[a].CompositeCollection[c].Type) { case "table_attribute": _list.Add(_tableField = new DBTableField()); _tableField.isIdentity = false; for (int aa = 0; aa < AttributeCollection[a].CompositeCollection[c].AttributeCollection.Count; aa++) { switch (AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Name) { case "name": _tableField.Name = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].String.Replace("#", ""); break; case "primary_key": _tableField.isPK = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "unique": _tableField.isUnique = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "nullable": _tableField.isNullable = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "comment": string[] _comment = OGen.lib.utils.ParamvalueList_Split( AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].String.Replace("#", ""), ";", ":", "identity", // ___________ 0 "length", // _____________ 1 "sqlserver", // __________ 2 "psql", // _______________ 3 "numericPrecision", // ___ 4 "numericScale", // _______ 5 "type", // _______________ 6 "unique" // ______________ 7 ); if (_comment[0] != "") { _tableField.isIdentity = bool.Parse(_comment[0]); } if (_comment[1] != "") { _tableField.Size = int.Parse(_comment[1]); } if (_comment[2] != "") { _tableField.DBType_inDB_name = _comment[2]; } if (_comment[3] != "") { _tableField.DBType_inDB_name = _comment[3]; } if (_comment[4] != "") { _tableField.Numeric_Precision = int.Parse(_comment[4]); } if (_comment[5] != "") { _tableField.Numeric_Scale = int.Parse(_comment[5]); } break; default: break; } } break; } } #endregion break; } } return(_list.ToArray()); }
public DBTableField[] TableFields() { DBTableField _tableField; System.Collections.Generic.List<DBTableField> _list = new System.Collections.Generic.List<DBTableField>(); for (int a = 0; a < AttributeCollection.Count; a++) { switch (AttributeCollection[a].Name) { case "attributes": #region _list.Add( ... ); for (int c = 0; c < AttributeCollection[a].CompositeCollection.Count; c++) { switch (AttributeCollection[a].CompositeCollection[c].Type) { case "table_attribute": _list.Add(_tableField = new DBTableField()); _tableField.isIdentity = false; for (int aa = 0; aa < AttributeCollection[a].CompositeCollection[c].AttributeCollection.Count; aa++) { switch (AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Name) { case "name": _tableField.Name = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].String.Replace("#", ""); break; case "primary_key": _tableField.isPK = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "unique": _tableField.isUnique = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "nullable": _tableField.isNullable = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].Boolean.Val; break; case "comment": _tableField.DBDescription = AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].String.Replace("#", ""); string[] _comment = OGen.lib.utils.ParamvalueList_Split( //AttributeCollection[a].CompositeCollection[c].AttributeCollection[aa].String.Replace("#", ""), _tableField.DBDescription, ";", ":", "identity", // ___________ 0 "length", // _____________ 1 "sqlserver", // __________ 2 "psql", // _______________ 3 "numericPrecision", // ___ 4 "numericScale", // _______ 5 "type", // _______________ 6 "unique" // ______________ 7 ); if (_comment[0] != "") _tableField.isIdentity = bool.Parse(_comment[0]); if (_comment[1] != "") _tableField.Size = int.Parse(_comment[1]); // sql server if (_comment[2] != "") _tableField.SQLServerTypeName = _comment[2]; // postgresql if (_comment[3] != "") _tableField.PostgreSQLTypeName = _comment[3]; if (_comment[4] != "") _tableField.Numeric_Precision = int.Parse(_comment[4]); if (_comment[5] != "") _tableField.Numeric_Scale = int.Parse(_comment[5]); break; default: break; } } break; } } #endregion break; } } return _list.ToArray(); }