Repository navigation
Commit 224ca93
Output parameters: one name rule for every named output, and capture fixes (#297)
* Captures: refuse a command that re-implements its reader
A capture reads the outputs through the library's own reader path. A
command type that re-implements IExecuteReader replaces that path, so a
capture on it used to be bypassed: the library took its own reader and
ignored the override. It is now refused.
A capture made on a mapped query throws NotSupportedException at the
capture call. A capture made on the command throws
InvalidOperationException when the query runs, at the one place every
captured run passes, and completes every capture with the same
exception, so none is left pending. Both messages name the command type
and say to capture on a command that does not re-implement the
interface, or to read the outputs with ExecuteOutputAsync.
The library's own command types are decided by an exact type test, with
no lookup. Any other type is examined once with reflection (every
interface that extends IExecuteReader, and the declaring type of each
method that implements it) and the answer is kept in a table that does
not hold the type alive. A type that cannot be examined is refused with a
message that says so; that failure is not cached. A call without a
capture is not affected.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Output parameters: one name rule for every named output
A named output (ExecuteOutputAsync<T>(name), its decimal forms, and
CaptureOutput<T>(name, ...) / CaptureOutputDecimal(name, ...) on a command
and on a mapped query) now finds its parameter the way the name of AddParam
does: exactly, else ignoring case, else ignoring case and underscores, else
without a common prefix such as p_; a lower rule applies only when no higher
one matches. "totalCount" finds @total_count. [Column("name")] members keep
exact matching.
A name that fits two parameters at the same level throws a message that says
to pass the exact parameter name, not to use [Column]. Two named captures
that resolve to one parameter fail the run and say how to fix it; the call
cannot see that, because it compares the names as written.
Docs and release notes state the one rule.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Captures: a run fills every capture its command has when it starts
A mapped query that had a capture of its own took a snapshot of its
command's captures when the capture was added, so a capture added to the
command afterwards was never armed. The query now keeps only its own
captures, and a run combines the command's captures as they are then (first,
so the order is stable) with the query's own. The combined set is kept per
command set, so the calls of one run get the same set and layout, and a query
or command with nothing to combine allocates nothing new.
A capture added to the query is still checked against the command's current
captures at the call. A command capture added later that reads what a query
capture reads is found when the terminal, the stream or the buffer is called,
and throws before anything is armed or run. A stream or buffer takes the
command's captures when it is made.
The stall timeout test now also checks that the capture faults with the same
type and message as the loop; it passes without a code change.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Captures: the return-code check moves to the run, and the early-stop cost and the claims in the docs are made explicit
A capture of the return code was refused at the capture call when the
command was not a stored procedure. The command's type is a public setter, so
a valid chain written in the other order (the capture first, the type set
after) was refused. The check now happens only when the run starts, where it
already was, and fails the terminal and the capture with the same message.
The unused procedure flag of the capture runner and of the capture set is
removed.
Leaving a captured stream early still reads the rest of the response so every
output arrives; the docs now say that the loop's exit waits for it, that the
stall timeout does not bound the wait, that a token the caller passed still
cancels the read, and what to do instead. A test pins that a break after one
row of many still fills the capture.
ExecuteReturnAsync with a model documents and tests that it throws at the
call. Documentation claims without a test are now either proven (a compile
test for the ambiguous byte zero call on the SQL Server command) or softened
(SQLite's exception type; the sample's cast of a NULL output).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Docs for the AddParam database-type trap, a pin for ordinal gaps, and style fixes
AddParam("@id", DbType.Int32) on a SQL Server command binds to the value
overload and sends the enum as the value. No code guard works (a derived
overload would capture AddParam("x", 0), and on the generic base the
existing trap collides), so the shared AddParam remarks now say that a DbType
passed there is a value, and that the database type goes in the third
argument.
An output model with Order values 0 and 2 is pinned to behave as a row model
does: the gap is not read, and the map accepts the null label of the gap.
Members of internal types that were marked internal are public, and the list
of refused terminals in a capture test is grouped.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Captures: review fixes to the docs and tests
Docs and comments:
- A capture on a command that re-implements IExecuteReader is refused when
a mapped query over the command runs; the command's own terminals do not
use the re-implemented reader. Reworded in the MappedQuery comment, the
shared output docs and the expressive commands article.
- The capture name docs say that the same name, ignoring case, fails at the
call, and that only a looser match fails the run.
- ReaderReplacement.LookupCount counts one per successful lookup; a failed
lookup is retried and counted again.
- WithCapture lists the lookup failure it can throw.
- Cut the repeated name-rule, late-capture, and ordering wording.
- Re-indented one comment in the output parameters sample.
Tests:
- A late conflicting command capture keeps its captures and asserts that
they stay unarmed, with the fix text, and a synchronous terminal case.
- A capture added after a stream or buffer is made is not filled.
- A named capture and ExecuteOutputAsync find a p_ prefixed parameter.
- ExecuteOutputAsync works on a command that re-implements its reader.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>1 parent ac3d3e3 commit 224ca93
27 files changed
Lines changed: 1175 additions & 120 deletions
File tree
- Source
- Core
- MSSqlClient
- SqlClient
- Tests/Open.Database.Extensions.Core.Tests
- docsite
- articles
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
412 | | - | |
413 | 411 | | |
414 | | - | |
415 | | - | |
416 | | - | |
| 412 | + | |
| 413 | + | |
417 | 414 | | |
418 | 415 | | |
419 | 416 | | |
420 | | - | |
421 | | - | |
| 417 | + | |
422 | 418 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | 419 | | |
430 | 420 | | |
431 | 421 | | |
| |||
435 | 425 | | |
436 | 426 | | |
437 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
438 | 486 | | |
439 | 487 | | |
440 | | - | |
| 488 | + | |
441 | 489 | | |
442 | 490 | | |
443 | 491 | | |
| |||
983 | 1031 | | |
984 | 1032 | | |
985 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
986 | 1048 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
138 | 145 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| 103 | + | |
| 104 | + | |
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
| |||
114 | 119 | | |
115 | 120 | | |
116 | 121 | | |
| 122 | + | |
| 123 | + | |
117 | 124 | | |
118 | 125 | | |
119 | 126 | | |
| |||
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
| 147 | + | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| |||
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
176 | | - | |
177 | | - | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
182 | | - | |
183 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
184 | 203 | | |
185 | 204 | | |
186 | 205 | | |
| |||
234 | 253 | | |
235 | 254 | | |
236 | 255 | | |
237 | | - | |
238 | | - | |
| 256 | + | |
| 257 | + | |
239 | 258 | | |
240 | 259 | | |
241 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
415 | 423 | | |
416 | 424 | | |
417 | 425 | | |
| |||
425 | 433 | | |
426 | 434 | | |
427 | 435 | | |
428 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
429 | 439 | | |
430 | 440 | | |
431 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
| |||
1947 | 1951 | | |
1948 | 1952 | | |
1949 | 1953 | | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
1950 | 1961 | | |
1951 | 1962 | | |
1952 | 1963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
20 | 31 | | |
21 | 32 | | |
22 | 33 | | |
| |||
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
32 | | - | |
33 | | - | |
| 43 | + | |
34 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
35 | 48 | | |
36 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | 53 | | |
39 | 54 | | |
| |||
47 | 62 | | |
48 | 63 | | |
49 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
50 | 82 | | |
51 | | - | |
52 | | - | |
53 | 83 | | |
54 | | - | |
55 | | - | |
| 84 | + | |
| 85 | + | |
56 | 86 | | |
57 | 87 | | |
58 | 88 | | |
| |||
137 | 167 | | |
138 | 168 | | |
139 | 169 | | |
| 170 | + | |
| 171 | + | |
140 | 172 | | |
141 | 173 | | |
142 | 174 | | |
| |||
156 | 188 | | |
157 | 189 | | |
158 | 190 | | |
| 191 | + | |
| 192 | + | |
159 | 193 | | |
160 | 194 | | |
161 | 195 | | |
| |||
179 | 213 | | |
180 | 214 | | |
181 | 215 | | |
| 216 | + | |
| 217 | + | |
182 | 218 | | |
183 | 219 | | |
184 | 220 | | |
| |||
0 commit comments