Esempio n. 1
0
        public static void CreateNewIndexSet()
        {
            var tableName    = ObjectName.Parse("sys.table1");
            var indexSetInfo = new IndexSetInfo(tableName);

            Assert.Equal(tableName, indexSetInfo.TableName);
            Assert.False(indexSetInfo.IsReadOnly);
            Assert.Empty(indexSetInfo.Indexes);
        }
Esempio n. 2
0
            public IndexList(IndexSetInfo indexSetInfo, IEnumerable <IndexInfo> indexes)
            {
                this.indexSetInfo = indexSetInfo;

                this.indexes = new List <IndexInfo>();

                if (indexes != null)
                {
                    this.indexes.AddRange(indexes);
                }
            }
Esempio n. 3
0
        public static void AddIndexes()
        {
            var tableName    = ObjectName.Parse("sys.table1");
            var indexSetInfo = new IndexSetInfo(tableName);

            Assert.Equal(tableName, indexSetInfo.TableName);
            Assert.False(indexSetInfo.IsReadOnly);
            Assert.Empty(indexSetInfo.Indexes);

            indexSetInfo.Indexes.Add(new IndexInfo("idx1", tableName, new [] { "a", "b" }));
            Assert.NotEmpty(indexSetInfo.Indexes);
            Assert.Equal(0, indexSetInfo.FindIndexForColumns(new [] { "a", "b" }));
        }
        public static void Serialize(IndexSetInfo indexSetInfo, BinaryWriter writer)
        {
            var schemaName = indexSetInfo.TableName.Parent;
            var catName    = schemaName != null && schemaName.Parent != null ? schemaName.Parent.Name : String.Empty;
            var schema     = schemaName != null ? schemaName.Name : String.Empty;

            writer.Write(2);                            // Version
            writer.Write(catName);
            writer.Write(schema);
            writer.Write(indexSetInfo.TableName.Name);

            int indexCount = indexSetInfo.Indexes.Count;

            writer.Write(indexCount);

            for (int i = 0; i < indexCount; i++)
            {
                var index = indexSetInfo.Indexes[i];
                IndexInfoSerializer.Serialize(index, writer);
            }
        }