Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }