internal static List <string> getTableFields(DbConnection con, string table) { var data = new List <string>(); using (var reader = new DbCommandFactory(con, new SqlBuilderFactory(con).Create(con.Database).describeTableSql(table)).Create().ExecuteReader()) { while (reader.Read()) { data.Add(reader.GetString(0).ToUpper() + " " + reader.GetString(1) + ", Nullable:" + reader.GetString(2)); } } return(data); }
internal static List <Table> getTablesInfo(sqlservers server, DbConnection con) { var list = new List <Table>(); using (var r = new DbCommandFactory(con, new SqlBuilderFactory(server).Create(con.Database).getAllFieldsFromAllTablesInDb()).Create().ExecuteReader()) { while (r.Read()) { list.Add(new Table(r.GetString(0), r.GetString(1), r.GetString(2), r.GetString(3), r.GetValue(4) != DBNull.Value ? r.GetInt64(4) : default(long))); } } return(list); }
internal static List <string> getStringData(DbConnection con, string sql) { var data = new List <string>(); using (var reader = new DbCommandFactory(con, sql).Create().ExecuteReader()) { while (reader.Read()) { data.Add(reader.GetString(0).ToUpper()); } } return(data); }