Skip to content

Commit 40d7a13

Browse files
committed
Release v2.1.0 — structured schema types
1 parent f06a074 commit 40d7a13

9 files changed

Lines changed: 503 additions & 273 deletions

File tree

CHANGELOG.md

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,88 @@ This project follows [Semantic Versioning](https://semver.org/).
55

66
---
77

8+
## [2.1.0] — 2026-03-30
9+
10+
### ⚠️ Breaking Changes
11+
12+
| Area | Before | After |
13+
|------|--------|-------|
14+
| **`TableColumn.TypeName`** | `string` — e.g. `"Long Integer"` | **Removed** — replaced by `Type` (`System.Type`) |
15+
| **`TableColumn.SizeDesc`** | `string` — e.g. `"4 bytes"` | **Removed** — replaced by `Size` (`ColumnSize` struct) |
16+
| **`ReadFirstTable()`** | Returned `TableResult` | Now returns `FirstTableResult` (subclass of `TableResult`) |
17+
| **`GetTableStats()`** | Returned `List<(string Name, long RowCount, int ColumnCount)>` | Now returns `List<TableStat>` |
18+
| **`TableResult`** | `sealed` class | Unsealed — serves as base class for `FirstTableResult` |
19+
20+
### ✨ New Types
21+
22+
| Type | Description |
23+
|------|-------------|
24+
| `ColumnSizeUnit` | Enum: `Bits`, `Bytes`, `Chars`, `Variable`, `Lval` |
25+
| `ColumnSize` | Readonly struct — `Value` (`int?`) + `Unit` (`ColumnSizeUnit`). Factory methods: `FromBits`, `FromBytes`, `FromChars`. Sentinels: `Variable`, `Lval`. `ToString()` produces a human-readable description. |
26+
| `FirstTableResult` | Extends `TableResult` with `TableCount` (`int`) — the total number of user tables in the database. Returned by `ReadFirstTable()`. |
27+
| `TableStat` | Named class with `Name` (`string`), `RowCount` (`long`), `ColumnCount` (`int`). Returned as element of `List<TableStat>` from `GetTableStats()`. |
28+
29+
### 🔧 Improvements
30+
31+
- **`TableResult`** gains `TableName` (`string`) — the table this result was read from — and `RowCount` (`int`) computed property.
32+
- **`TableColumn.Type`** (`System.Type`) — exact CLR type, consistent with `ColumnMetadata.ClrType`.
33+
- **`TableColumn.Size`** (`ColumnSize`) — structured size with programmatic access to numeric value and unit; `ToString()` preserves the previous human-readable output.
34+
35+
### 📦 Migration Guide
36+
37+
```csharp
38+
// ── TableColumn schema properties ────────────────────────────────────
39+
// Before
40+
string typeName = col.TypeName; // "Long Integer"
41+
string sizeDesc = col.SizeDesc; // "4 bytes"
42+
// After
43+
Type clrType = col.Type; // typeof(int)
44+
int? bytes = col.Size.Value; // 4
45+
string display = col.Size.ToString(); // "4 bytes"
46+
bool isVar = col.Size.Unit == ColumnSizeUnit.Variable;
47+
48+
// ── ReadFirstTable ────────────────────────────────────────────────────
49+
// Before
50+
TableResult r = reader.ReadFirstTable();
51+
// After
52+
FirstTableResult r = reader.ReadFirstTable();
53+
int total = r.TableCount; // new property on FirstTableResult
54+
55+
// ── GetTableStats ─────────────────────────────────────────────────────
56+
// Before — tuple list
57+
foreach (var (name, rows, cols) in reader.GetTableStats()) { ... }
58+
// After — named class
59+
foreach (TableStat s in reader.GetTableStats())
60+
Console.WriteLine($"{s.Name}: {s.RowCount} rows, {s.ColumnCount} cols");
61+
```
62+
63+
---
64+
65+
## [2.0.1] — 2026-03-29
66+
67+
### ⚠️ Breaking Changes
68+
69+
| Before | After | Notes |
70+
|--------|-------|-------|
71+
| `TablePreviewResult` | `TableResult` | Renamed for clarity — remove the `Preview` prefix |
72+
| `TablePreviewColumn` | `TableColumn` | Renamed for clarity — remove the `Preview` prefix |
73+
74+
### 📦 Migration Guide
75+
76+
```csharp
77+
// Before
78+
TablePreviewResult p = r.ReadTable("Orders", 10);
79+
foreach (TablePreviewColumn col in p.Schema)
80+
Console.WriteLine($"{col.Name}: {col.TypeName} ({col.SizeDesc})");
81+
82+
// After
83+
TableResult p = r.ReadTable("Orders", 10);
84+
foreach (TableColumn col in p.Schema)
85+
Console.WriteLine($"{col.Name}: {col.TypeName} ({col.SizeDesc})");
86+
```
87+
88+
---
89+
890
## [2.0.0] — 2026-03-28
991

1092
### ⚠️ Breaking Changes
@@ -23,9 +105,9 @@ This project follows [Semantic Versioning](https://semver.org/).
23105
| Method | Description |
24106
|--------|-------------|
25107
| `ReadTable()` | Primary read method — typed `DataTable` (replaces `ReadTableAsDataTableTyped`) |
26-
| `ReadTable(string, int)` | Sampled-rows overload — returns `TableResult` (headers, rows, schema) |
108+
| `ReadTable(string, int)` | Sampled-rows overload — returns `TablePreviewResult` (headers, rows, schema) |
27109
| `ReadTableAsync()` | Async typed `DataTable` |
28-
| `ReadTableAsync(string, int)` | Async sampled-rows overload — returns `Task<TableResult>` |
110+
| `ReadTableAsync(string, int)` | Async sampled-rows overload — returns `Task<TablePreviewResult>` |
29111
| `StreamRowsAsStrings()` | Compatibility streaming — `IEnumerable<string[]>` |
30112
| `ReadAllTablesAsStrings()` | Bulk read with string columns |
31113
| `ReadAllTablesAsStringsAsync()` | Async bulk read with string columns |
@@ -38,8 +120,8 @@ This project follows [Semantic Versioning](https://semver.org/).
38120
| `TableQuery.Count()` / `CountAsStrings()` | Count per chain |
39121
| `GetColumnMetadata()` | Rich per-column metadata with CLR type |
40122
| `GetStatistics()` / `GetStatisticsAsync()` | Database-level statistics + cache hit rate |
41-
| `TableResult` | Result type for sampled-rows overload — `Headers`, `Rows`, `Schema` |
42-
| `TableColumn` | Schema entry — `Name`, `TypeName`, `SizeDesc` |
123+
| `TablePreviewResult` | Result type for sampled-rows overload — `Headers`, `Rows`, `Schema` |
124+
| `TablePreviewColumn` | Schema entry — `Name`, `TypeName` (`string`), `SizeDesc` (`string`) |
43125

44126
### 🔧 Improvements
45127

@@ -76,7 +158,7 @@ DataTable dt = r.ReadTableAsStringDataTable("Orders");
76158
// v1
77159
var (h, rows, schema) = r.ReadTable("Orders", maxRows: 10);
78160
// v2
79-
TableResult p = r.ReadTable("Orders", 10);
161+
TablePreviewResult p = r.ReadTable("Orders", 10);
80162
// p.Headers / p.Rows / p.Schema[i].Name, .TypeName, .SizeDesc
81163
82164
// ── Stream rows (typed) ──────────────────────────────────────────────

JetDatabaseReader.Tests/Core/AccessReaderCoreTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ public void ReadFirstTable_ReturnsNonEmptyHeadersAndTableName(string path)
228228
{
229229
using var reader = TestDatabases.Open(path);
230230

231-
var (headers, _, tableName, tableCount) = reader.ReadFirstTable();
231+
FirstTableResult result = reader.ReadFirstTable();
232232

233-
headers.Should().NotBeEmpty();
234-
tableName.Should().NotBeNullOrWhiteSpace();
235-
tableCount.Should().BeGreaterThan(0);
233+
result.Headers.Should().NotBeEmpty();
234+
result.TableName.Should().NotBeNullOrWhiteSpace();
235+
result.TableCount.Should().BeGreaterThan(0);
236236
}
237237

238238
// ── ReadTable (preview overload) ──────────────────────────────────

0 commit comments

Comments
 (0)