protected ColumnSchemaExtend GetColumnSchemaFromRow(DataRow row) { ColumnSchemaExtend schema = new ColumnSchemaExtend { Explain = row["DESCRIPTION"] as String, Name = row[ColumnOfName] as String, DbTypeString = row["EDM_TYPE"] as String }; //IsNullable schema.IsNullable = (Boolean)row[ColumnOfNullable]; //IsPrimaryKey schema.IsPrimaryKey = (Boolean)row["PRIMARY_KEY"]; //Length String columnTypeStr = row[ColumnOfLength].ToString(); if (Int32.TryParse(columnTypeStr, out Int32 length)) { schema.Length = length; } return(schema); }
public IList <ColumnSchemaExtend> LoadViewColumnSchemaList(String viewName) { List <ColumnSchemaExtend> columnSchemas = new List <ColumnSchemaExtend>(); String SQL = String.Format(SQLForViewColumnSchemaWithWhere, viewName); DataTable info = this.ExecuteQuery(SQL); if (info.Rows.Count > 0) { foreach (DataRow row in info.Rows) { ColumnSchemaExtend schema = this.GetColumnSchemaFromRow(row); columnSchemas.Add(schema); } } return(columnSchemas); }
public IList <ColumnSchemaExtend> LoadViewColumnSchemaList(String viewName) { List <ColumnSchemaExtend> columnSchemas = new List <ColumnSchemaExtend>(); String dataBase = this.GetDataBaseName(); DataTable info = this._connection.GetSchema("ViewColumns", new String[] { null, dataBase, viewName, null }); if (info.Rows.Count > 0) { foreach (DataRow row in info.Rows) { ColumnSchemaExtend schema = this.GetColumnSchemaFromRow(row); columnSchemas.Add(schema); } } return(columnSchemas); }
protected ColumnSchemaExtend GetColumnSchemaFromRow(DataRow row) { ColumnSchemaExtend schema = new ColumnSchemaExtend { Explain = row[ColumnOfComment] as String, Name = row[ColumnOfName] as String, DbTypeString = row[ColumnOfDbType] as String }; //IsNullable String nullableStr = row[ColumnOfNullable].ToString(); if (nullableStr == NullableOfYes) { schema.IsNullable = true; } else { schema.IsNullable = false; } //IsPrimaryKey String priStr = row[ColumnOfKey].ToString(); if (priStr == KeyTypeOfPrimary) { schema.IsPrimaryKey = true; } //Length String lengthStr = row[ColumnOfLength].ToString(); if (Int32.TryParse(lengthStr, out Int32 length)) { schema.Length = length; } return(schema); }