• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DataScanner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DataScanner的典型用法代码示例。如果您正苦于以下问题:C# DataScanner类的具体用法?C# DataScanner怎么用?C# DataScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataScanner类属于命名空间,在下文中一共展示了DataScanner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BigintTests

        public void BigintTests(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("BigintTests").ToList();

                Assert.AreEqual(1, rows[0].Field<long?>("A"));
                Assert.AreEqual(-125, rows[1].Field<long?>("A"));
                Assert.AreEqual(-129, rows[2].Field<long?>("A"));
                Assert.AreEqual(-130, rows[3].Field<long?>("A"));
                Assert.AreEqual(125, rows[4].Field<long?>("A"));
                Assert.AreEqual(130, rows[5].Field<long?>("A"));
                Assert.AreEqual(-32768, rows[6].Field<long?>("A"));
                Assert.AreEqual(32767, rows[7].Field<long?>("A"));
                Assert.AreEqual(null, rows[8].Field<long?>("A"));
                Assert.AreEqual(0, rows[9].Field<long?>("A"));
                Assert.AreEqual(32768, rows[10].Field<long?>("A"));
                Assert.AreEqual(8388607, rows[11].Field<long?>("A"));
                Assert.AreEqual(2147483647, rows[12].Field<long?>("A"));
                Assert.AreEqual(-8388608, rows[13].Field<long?>("A"));
                Assert.AreEqual(-8388609, rows[14].Field<long?>("A"));
                Assert.AreEqual(-2147483648, rows[15].Field<long?>("A"));
                Assert.AreEqual(9223372036854775807, rows[16].Field<long?>("A"));
                Assert.AreEqual(36028797018963967, rows[17].Field<long?>("A"));
                Assert.AreEqual(140737488355327, rows[18].Field<long?>("A"));
                Assert.AreEqual(549755813887, rows[19].Field<long?>("A"));
                Assert.AreEqual(2147483648, rows[20].Field<long?>("A"));
                Assert.AreEqual(-9223372036854775808, rows[21].Field<long?>("A"));
                Assert.AreEqual(-36028797018963967, rows[22].Field<long?>("A"));
                Assert.AreEqual(-140737488355327, rows[23].Field<long?>("A"));
                Assert.AreEqual(-549755813887, rows[24].Field<long?>("A"));
                Assert.AreEqual(-2147483648, rows[25].Field<long?>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:35,代码来源:DataTypeTests.cs


示例2: VarcharBlobInlineRoot

        public void VarcharBlobInlineRoot(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("VarcharBlobInlineRoot").ToList();

                Assert.AreEqual("".PadLeft(25000, 'A'), rows[0].Field<string>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:RowOverflowTests.cs


示例3: Image65

        public void Image65(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("ImageTest65").ToList();

                Assert.AreEqual(Encoding.UTF7.GetBytes("".PadLeft(65, 'A')), rows[0].Field<byte[]>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:ImageTests.cs


示例4: NText4020

        public void NText4020(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("NTextTest4020").ToList();

                Assert.AreEqual("".PadLeft(4020, '\u040A'), rows[0].Field<string>("A"));
            });
        }
开发者ID:the263,项目名称:OrcaMDF,代码行数:10,代码来源:NTextTests.cs


示例5: NVarcharMax33

        public void NVarcharMax33(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("NVarcharMaxTest33").ToList();

                Assert.AreEqual("".PadLeft(33, '\u040A'), rows[0].Field<string>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:NVarcharMaxTests.cs


示例6: Text65

        public void Text65(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("TextTest65").ToList();

                Assert.AreEqual("".PadLeft(65, 'A'), rows[0].Field<string>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:TextTests.cs


示例7: FGSpecificClusteredAllocation

        public void FGSpecificClusteredAllocation(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("FGSpecificClustered").ToList();

                Assert.AreEqual(100, rows.Count);
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:MultiFileTests.cs


示例8: VarcharMax8040

        public void VarcharMax8040(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("VarcharMaxTest8040").ToList();

                Assert.AreEqual("".PadLeft(8040, 'A'), rows[0].Field<string>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:VarcharMaxTests.cs


示例9: RoundRobinHeapAllocation

        public void RoundRobinHeapAllocation(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("RoundRobinHeap").ToList();

                Assert.AreEqual(100, rows.Count);
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:MultiFileTests.cs


示例10: VarBinary8040

        public void VarBinary8040(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("VarBinaryTest8040").ToList();

                Assert.AreEqual(Encoding.UTF7.GetBytes("".PadLeft(8040, 'A')), rows[0].Field<byte[]>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:10,代码来源:VarBinaryTests.cs


示例11: ScanIndex

        public IEnumerable<Row> ScanIndex(string tableName, string indexName)
        {
            // Get table
            var table = Database.Dmvs.Objects
                .Where(x => x.Name == tableName && (x.Type == ObjectType.USER_TABLE || x.Type == ObjectType.SYSTEM_TABLE))
                .SingleOrDefault();

            if (table == null)
                throw new UnknownTableException(tableName);

            // Get index
            var index = Database.Dmvs.Indexes
                .Where(i => i.ObjectID == table.ObjectID && i.Name == indexName)
                .SingleOrDefault();

            if (index == null)
                throw new UnknownIndexException(tableName, indexName);

            // Depending on index type, scan accordingly
            switch(index.Type)
            {
                case IndexType.Heap:
                case IndexType.Clustered:
                    // For both heaps and clustered tables we delegate the responsibility to a DataScanner
                    var scanner = new DataScanner(Database);
                    return scanner.ScanTable(tableName);

                case IndexType.Nonclustered:
                    // Get the schema for the index
                    var schema = MetaData.GetEmptyIndexRow(tableName, indexName);

                    // Get rowset for the index
                    var tableRowset = Database.Dmvs.SystemInternalsPartitions
                        .Where(x => x.ObjectID == table.ObjectID && x.IndexID == index.IndexID)
                        .FirstOrDefault();

                    if (tableRowset == null)
                        throw new Exception("Index has no rowset");

                    // Get allocation unit for in-row data
                    var allocUnit = Database.Dmvs.SystemInternalsAllocationUnits
                        .Where(au => au.ContainerID == tableRowset.PartitionID && au.Type == (byte)AllocationUnitType.IN_ROW_DATA)
                        .SingleOrDefault();

                    if (allocUnit == null)
                        throw new ArgumentException("Table has no allocation unit.");

                    // Scan the linked list of nonclustered index pages
                    // TODO: Support compressed indexes
                    return ScanLinkedNonclusteredIndexPages(allocUnit.FirstPage, schema, CompressionContext.NoCompression);

                default:
                    throw new ArgumentException("Unsupported index type '" + index.Type + "'");
            }
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:55,代码来源:IndexScanner.cs


示例12: ScanAllNullSparse

        public void ScanAllNullSparse(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("ScanAllNullSparse").ToList();

                Assert.AreEqual(null, rows[0].Field<int?>("A"));
                Assert.AreEqual(null, rows[0].Field<int?>("B"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:11,代码来源:SparseColumnTests.cs


示例13: BinaryTests

        public void BinaryTests(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("BinaryTest").ToList();

                Assert.AreEqual(null, rows[0].Field<byte[]>("A"));
                Assert.AreEqual(TestHelper.GetBytesFromByteString("25FF2500000000000000"), rows[1].Field<byte[]>("A"));
                Assert.AreEqual(TestHelper.GetBytesFromByteString("01020304050607080910"), rows[2].Field<byte[]>("A"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:12,代码来源:DataTypeTests.cs


示例14: Garbage2

        public void Garbage2(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("Garbage2").ToList();

                Assert.AreEqual(5, rows[0].Field<int?>("A"));
                Assert.AreEqual(2, rows[0].Field<int?>("B"));
                Assert.AreEqual(null, rows[0].Field<string>("C"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:12,代码来源:NullBitmapTests.cs


示例15: MultipleShortDataColumns

        public void MultipleShortDataColumns(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("MultipleShortDataColumns").ToList();

                Assert.AreEqual(1, rows[0].Field<byte>("A"));
                Assert.AreEqual(2, rows[0].Field<byte>("B"));
                Assert.AreEqual(3, rows[0].Field<byte>("C"));
            });
        }
开发者ID:rajeshpillai,项目名称:OrcaMDF,代码行数:12,代码来源:RecordFormatTests.cs


示例16: MultipleLongDataColumns

        public void MultipleLongDataColumns(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("MultipleLongDataColumns").ToList();

                Assert.AreEqual(TestHelper.GetBytesFromByteString("01020304050607080910"), rows[0].Field<byte[]>("A"));
                Assert.AreEqual(TestHelper.GetBytesFromByteString("09080706050403020100"), rows[0].Field<byte[]>("B"));
                Assert.AreEqual(TestHelper.GetBytesFromByteString("112233445566778899AA"), rows[0].Field<byte[]>("C"));
            });
        }
开发者ID:rajeshpillai,项目名称:OrcaMDF,代码行数:12,代码来源:RecordFormatTests.cs


示例17: RowOverflowPointer

        public void RowOverflowPointer(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("RowOverflowPointer").ToList();

                Assert.AreEqual(1, rows.Count);
                Assert.AreEqual("".PadLeft(5000, 'a'), rows[0]["A"]);
                Assert.AreEqual("".PadLeft(5000, 'b'), rows[0]["B"]);
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:12,代码来源:RecordTests.cs


示例18: DifferingRecordFormats

        public void DifferingRecordFormats(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("DifferingRecordFormats").ToList();

                Assert.AreEqual(5, rows[0].Field<int?>("A"));
                Assert.AreEqual(2, rows[0].Field<int?>("B"));
                Assert.AreEqual(6, rows[1].Field<int?>("A"));
                Assert.AreEqual(null, rows[1].Field<int?>("B"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:13,代码来源:SparseColumnTests.cs


示例19: DecimalTest

        public void DecimalTest(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("DecimalTest").ToList();

                Assert.AreEqual(12345m, rows[0].Field<decimal>("A"));
                Assert.AreEqual(39201.230m, rows[0].Field<decimal>("B"));
                Assert.AreEqual(-4892384.382090m, rows[0].Field<decimal>("C"));
                Assert.AreEqual(1328783742987.29m, rows[0].Field<decimal>("D"));
                Assert.AreEqual(2940382040198493029.235m, rows[0].Field<decimal>("E"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:14,代码来源:DecimalTests.cs


示例20: ScanUniqueClusteredTable

        public void ScanUniqueClusteredTable(DatabaseVersion version)
        {
            RunDatabaseTest(version, db =>
            {
                var scanner = new DataScanner(db);
                var rows = scanner.ScanTable("UniqueClusteredTable").ToList();

                Assert.AreEqual(112, rows[0].Field<int>("Num1"));
                Assert.AreEqual("Doe", rows[0].Field<string>("Name"));

                Assert.AreEqual(382, rows[1].Field<int>("Num1"));
                Assert.AreEqual("John", rows[1].Field<string>("Name"));
            });
        }
开发者ID:Robin--,项目名称:OrcaMDF,代码行数:14,代码来源:DataScannerTests.cs



注:本文中的DataScanner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DataSegment类代码示例发布时间:2022-05-24
下一篇:
C# DataRowVersion类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap