Commit cee85a7
Fix IndexOutOfRangeException in reader metadata after exhausting result. Fixes #332
DataTable.Load (and similar consumers) read all rows and then call
NextResult() to probe for more result sets. InitNextReader() disposed the
vector readers and set vectorReaders=[] at the top of the method, before
checking whether another result set existed. When none did, it returned
false with vectorReaders emptied but fieldCount still holding the previous
result's column count. A subsequent GetSchemaTable()/GetName()/GetFieldType()
then indexed past the emptied array and threw IndexOutOfRangeException.
This regressed in 1.5.0 with the cross-chunk reader-reuse refactor; in 1.4.4
the readers were only replaced when a new result set was found, so an
exhausted reader kept its column metadata.
Move the dispose + clear inside the QueryResult branch so they run only when
switching to a new result set. An exhausted reader now retains its column
metadata, restoring 1.4.4 behavior.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9efba7e commit cee85a7
2 files changed
Lines changed: 36 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
51 | 44 | | |
52 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
356 | 385 | | |
357 | 386 | | |
358 | 387 | | |
| |||
0 commit comments