Exemplo n.º 1
0
        /// <summary>
        /// Liste des index d'une table
        /// </summary>
        /// <param name="table">The table.</param>
        /// <returns></returns>
        public override List <DbIndex> GetIndexes(DbTable table)
        {
            List <DbIndex> results = new List <DbIndex>();

            string[] restrictions = new string[4];
            restrictions[2] = table.Owner;
            restrictions[3] = table.Name;
            DataTable indexes = ((OracleConnection)connection).GetSchema("Indexes", restrictions);

            foreach (DataRow row in indexes.Rows)
            {
                string indexName = row["index_name"].ToString();

                DbIndex ind = new DbIndex();
                ind.Name = indexName;
                results.Add(ind);

                restrictions[0] = table.Owner;
                restrictions[1] = indexName;
                DataTable indexColumns = ((OracleConnection)connection).GetSchema("IndexColumns", restrictions);
                foreach (DataRow row2 in indexColumns.Rows)
                {
                    ind.Columns.Add(table.FindColumn(row2["column_name"].ToString()));
                }
            }
            return(results);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Liste des index d'une table
        /// </summary>
        /// <param name="table">The table.</param>
        /// <returns></returns>
        public override List <DbIndex> GetIndexes(DbTable table)
        {
            List <DbIndex> results = new List <DbIndex>();

            string[] restrictions = new string[5];
            restrictions[4] = table.Name;
            DataTable schema = ((OleDbConnection)connection).GetSchema("Indexes", restrictions);

            foreach (DataRow row in schema.Rows)
            {
                string  indexName = row["index_name"].ToString();
                DbIndex ind       = results.Find(delegate(DbIndex i) { return(i.Name == indexName); });
                if (ind == null)
                {
                    ind      = new DbIndex();
                    ind.Name = indexName;
                    results.Add(ind);
                }
                ind.Columns.Add(table.FindColumn(row["column_name"].ToString()));
            }
            return(results);
        }