public async Task ReadDbfRowsAsync() { var dbf = new Dbf(Path.Combine(testDir, "poshistorie.dbf")); var reader = new DbfReader(dbf); int count = 0; await foreach (var r in reader.ReadRowsAsync((i, x) => true, includeMemo: false, includeDeleted: true)) { count++; //if (count > 50) break; } output.WriteLine("Count: {0} ({1})", count, dbf.GetHeader().RecordCount); Assert.Equal(dbf.GetHeader().RecordCount, count); }
public void ReadNullTbl_Large() { var dbf = new Dbf(Path.Combine(testDir, "_largenullable.dbf")); var reader = new DbfReader(dbf); var header = dbf.GetHeader(); var row2 = reader.ReadRow(0); var rows = reader.ReadRows().ToList(); }
public static Database FromDbf(Dbf dbf) { var header = dbf.GetHeader(); if ((header.Flags & DbfHeaderFlags.DBC) == 0) { throw new InvalidCastException("Not a Database(DBC)"); } var reader = new DbfReader(dbf); var rows = reader.ReadRows(includeMemo: true); var db = ParseDatabaseFromRows(rows); return(db); }
public void PosHistorieAusgebenTable() { var dbf = new Dbf(Path.Combine(testDir, "poshistorie.dbf")); var reader = new DbfReader(dbf); var header = dbf.GetHeader(); using (var sw = new StreamWriter(Path.Combine(testDir, $"Fact_{nameof(PosHistorieAusgebenTable)}.md"))) { //reader.ReadRows((i, v) => i > (header.CalculatedRecordCount - 10), true).Count(); //OutputHelper.MarkdownTable(header.Fields, reader.ReadRows(true).Take(50), h => h, sw.WriteLine); OutputHelper.MarkdownTable( new[] { "RAW CONTENT" }, reader.ReadRowsRaw().Select(x => new[] { OutputHelper.ByteArrayToX2(x) }).Take(50).ToList(), h => h, sw.WriteLine); } }
public void Test1() { var dbf = new Dbf(Path.Combine(testDir, "dbTable2.dbf")); //var dbf = new Dbf(Path.Combine(@"C:\vfp projects\WindowsShell", "varchr.dbf")); var reader = new DbfReader(dbf); var row = reader.ReadRow(0); var header = dbf.GetHeader(); OutputHelper.MarkdownTable(header.Fields, reader.ReadRows(), h => h, output.WriteLine); var row2 = reader.ReadRow(1); var row3 = reader.ReadRow(2); //var rows = reader.ReadRows(includeMemo: true).ToList(); //Assert.Equal(6, reader.ReadRow(1)[1].ToString().Length); //Assert.Equal(254, reader.ReadRow(0)[1].ToString().Length); //Assert.Equal(254, reader.ReadRow(2)[1].ToString().Length); }