示例#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);
        }
示例#2
0
        internal static int getIntSingleResult(DbConnection con, string sql)
        {
            int result = 0;

            using (var reader = new DbCommandFactory(con, sql).Create().ExecuteReader())
            {
                while (reader.Read())
                {
                    result = reader.GetInt32(0);
                }
            }
            return(result);
        }
示例#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);
        }
示例#4
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);
        }