本文整理汇总了C#中DataScanner类的典型用法代码示例。如果您正苦于以下问题:C# DataScanner类的具体用法?C# DataScanner怎么用?C# DataScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataScanner类属于命名空间,在下文中一共展示了DataScanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
});
}
示例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"));
});
}
示例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"));
});
}
示例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"));
});
}
示例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"));
});
}
示例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"));
});
}
示例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);
});
}
示例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"));
});
}
示例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);
});
}
示例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"));
});
}
示例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 + "'");
}
}
示例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"));
});
}
示例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"));
});
}
示例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"));
});
}
示例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"));
});
}