Commit 9da889e
committed
BACPAC loader —
**Parser fix** (`SqlServerSimulator/Storage/SqlType.cs::ResolveSimpleKeyword`). The simulator already shipped `SystemNameSqlType` (sys-schema alias over nvarchar(128) NOT NULL, with id 231 sharing nvarchar's system_type_id and user_type_id 256), but the length-7 dispatch arm in `ResolveSimpleKeyword` didn't include it. Any column / parameter declared `sysname` hit the `null` fallback and raised Msg 243 (CAST/parameter path) or Msg 2715 (column-declaration path). Added `"SYSNAME" => SystemName` to the length-7 case.
**BCP wire-format fix** (`SqlServerSimulator/Storage/Bacpac/BcpRowReader.cs`). The variable-length-bounded dispatch switch didn't have a `SystemNameSqlType` arm, so a column declared as sysname would throw `NotSupportedException` ("BCP decoder doesn't yet handle type sysname") at row decode time. Added `SystemNameSqlType => ReadVarchar2(stream, type, ansi: false)` to the type-dispatch switch and `SystemNameSqlType => SqlValue.FromSystemName(text)` to the post-read materialization switch — same 2-byte LE length-prefix UTF-16 wire layout as nvarchar, which is what real SQL Server's BCP also emits for sysname columns.
**Bacpac-loader workaround removed** (`SqlServerSimulator/Storage/Bacpac/ModelXmlReader.cs::NormalizeBuiltinName`). Previously expanded `[sys].[sysname]` → `nvarchar(128)` inline as a "the parser doesn't know sysname yet" workaround. With the parser fix in place, that's removed: bare `sysname` reaches the column-type parser as a keyword, and `sys.columns` now reports sysname as the type name for sysname-declared columns (previously it surfaced as nvarchar(128) due to the substitution). The XML doc on `NormalizeBuiltinName` is rewritten to match — generic sys-prefix stripping only.
**Test updates**:
- New `Load_WWI_Sysname_Procs_Land_In_sys_procedures` — verifies the three WWI procs are in `sys.procedures` (positive landing check).
- `Load_WWI_Known_Gaps_Recorded_In_Skipped` — `IsFalse(grouped.ContainsKey("SqlProcedure"))` replaces the `AreEqual(3, …)` assertion since all 3 now load.
**Doc updates**: `CLAUDE.md`'s BACPAC pointer refreshes the WWI element census (adds "42/42 procedures", drops "3 SqlProcedure" from the Skipped catalog). `docs/claude/bacpac-prerequisites.md` gets a new step 5 covering this bundle (with the rationale for removing the `nvarchar(128)` substitution, the BCP wire-format companion change, and the sys.columns fidelity win); the WWI gap inventory's SqlProcedure entry strikes through with a "shipped in step 5" note; the Status section's WWI summary picks up the 42/42 procedure count.sysname keyword + BCP wire-format. All three previously-failing WWI procedures (Application.AddRoleMemberIfNonexistent, Application.CreateRoleIfNonexistent, Sequences.ReseedSequenceBeyondTableValues) — each declaring sysname parameters via DACFx's [sys].[sysname] TypeSpecifier — now CREATE successfully. WWI gap census drops by one whole category: SqlProcedure 3 → 0. AW unaffected.1 parent eb4a42b commit 9da889e
6 files changed
Lines changed: 43 additions & 17 deletions
File tree
- SqlServerSimulator.Tests.Internal/Storage
- SqlServerSimulator/Storage
- Bacpac
- docs/claude
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
602 | 603 | | |
603 | 604 | | |
604 | | - | |
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
651 | 678 | | |
652 | 679 | | |
653 | 680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| 334 | + | |
333 | 335 | | |
334 | 336 | | |
335 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
650 | 646 | | |
651 | 647 | | |
652 | 648 | | |
653 | 649 | | |
654 | 650 | | |
655 | | - | |
656 | | - | |
| 651 | + | |
657 | 652 | | |
658 | 653 | | |
659 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
842 | 842 | | |
843 | 843 | | |
844 | 844 | | |
| 845 | + | |
845 | 846 | | |
846 | 847 | | |
847 | 848 | | |
| |||
0 commit comments