Commit e3df5b3
committed
SchemaObject abstract base — unify the metadata of every named schema-resident database object behind one type. HeapTable / View / Procedure / Sequence / TableType / Trigger / UserDefinedFunction (and its ScalarFunction / InlineTableValuedFunction sealed derivees) all
: SchemaObject(name, objectId, schemaId, createDate) now; their duplicated Name / ObjectId / CreateDate fields are gone. The base also stores ModifyDate (mutable, defaults to CreateDate so the ALTER-bumps-modify-date hook lands in one place) and exposes two abstract members — ObjectTypeCode (the 2-char sys.objects.type: 'U '/'V '/'P '/'FN'/'IF'/'TR'/'SO'/'TT') and ObjectTypeDescription ('USER_TABLE'/'VIEW'/etc.) — so catalog-view projection reads the discriminator directly off the instance rather than threading 18 precomputed SqlValues through helper methods. TableType.TypeTableObjectId folded into the inherited ObjectId (and that's now what sys.table_types.type_table_object_id projects). Trigger.Parent typed as SchemaObject (was object); the ParentObjectId runtime-switch property gone — call sites read trigger.Parent.ObjectId directly. DML hook parameters (Update / Delete / Drop / InvokeTrigger) retyped object→SchemaObject; the (object?)sourceView ?? table ternaries become (SchemaObject?)sourceView ?? table. New Schema.SchemaObjects() yields every object in the shared object-name namespace (HeapTables + Views + Functions + Procedures + Sequences + Triggers — TableTypes deliberately excluded since probe-confirmed those occupy a separate namespace), and Schema.HasNameInSharedNamespace(leaf) tightens the previously-inconsistent CREATE-time Msg 2714 check: CREATE TABLE was missing the cross-kind scan entirely; CREATE FUNCTION checked only 2 dicts; CREATE VIEW checked 3; CREATE PROCEDURE checked 3; CREATE SEQUENCE checked 4; CREATE TRIGGER checked 5. All six paths now call the same one-line predicate and reject every shared-namespace collision (matches real SQL Server's behavior — none of the existing tests broke since each one was already testing within its dict's scope). sys.objects iteration collapses from 5 manually-ordered kind groups with hand-coded type/typeDesc per yield to a single schema.SchemaObjects().OrderBy(o => o.ObjectId) loop reading obj.ObjectTypeCode / obj.ObjectTypeDescription directly; constraint rows (PK / UQ / CHECK) still emit immediately after their owning HeapTable so the natural ordering matches probe. EnumerateProcedures / EnumerateSysTriggers stay single-kind enumerators with hoisted type/typeDesc constants for per-row allocation savings. 3326 / 264 tests pass; dotnet format clean. No behavior change beyond the tightened CREATE-time collision check.1 parent 71ed92f commit e3df5b3
21 files changed
Lines changed: 241 additions & 262 deletions
File tree
- SqlServerSimulator
- Parser
- Simulation
- Storage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | 185 | | |
192 | 186 | | |
193 | 187 | | |
| |||
202 | 196 | | |
203 | 197 | | |
204 | 198 | | |
205 | | - | |
| 199 | + | |
206 | 200 | | |
207 | 201 | | |
208 | 202 | | |
| |||
367 | 361 | | |
368 | 362 | | |
369 | 363 | | |
370 | | - | |
| 364 | + | |
371 | 365 | | |
372 | 366 | | |
373 | 367 | | |
| |||
522 | 516 | | |
523 | 517 | | |
524 | 518 | | |
525 | | - | |
| 519 | + | |
526 | 520 | | |
527 | 521 | | |
528 | 522 | | |
| |||
624 | 618 | | |
625 | 619 | | |
626 | 620 | | |
627 | | - | |
| 621 | + | |
628 | 622 | | |
629 | 623 | | |
630 | 624 | | |
| |||
651 | 645 | | |
652 | 646 | | |
653 | 647 | | |
| 648 | + | |
654 | 649 | | |
655 | | - | |
656 | | - | |
657 | | - | |
| 650 | + | |
658 | 651 | | |
659 | 652 | | |
660 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
661 | 659 | | |
662 | 660 | | |
663 | 661 | | |
| |||
668 | 666 | | |
669 | 667 | | |
670 | 668 | | |
671 | | - | |
| 669 | + | |
672 | 670 | | |
673 | 671 | | |
674 | 672 | | |
| |||
751 | 749 | | |
752 | 750 | | |
753 | 751 | | |
754 | | - | |
| 752 | + | |
755 | 753 | | |
756 | | - | |
| 754 | + | |
757 | 755 | | |
758 | 756 | | |
759 | 757 | | |
760 | 758 | | |
761 | | - | |
762 | | - | |
| 759 | + | |
763 | 760 | | |
764 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
765 | 767 | | |
766 | 768 | | |
767 | 769 | | |
| |||
1110 | 1112 | | |
1111 | 1113 | | |
1112 | 1114 | | |
1113 | | - | |
| 1115 | + | |
1114 | 1116 | | |
1115 | | - | |
| 1117 | + | |
1116 | 1118 | | |
1117 | 1119 | | |
1118 | 1120 | | |
| |||
1346 | 1348 | | |
1347 | 1349 | | |
1348 | 1350 | | |
1349 | | - | |
| 1351 | + | |
1350 | 1352 | | |
1351 | 1353 | | |
1352 | 1354 | | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
1358 | 1355 | | |
1359 | 1356 | | |
1360 | 1357 | | |
1361 | 1358 | | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
1404 | | - | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | | - | |
1409 | | - | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
1410 | 1365 | | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1411 | 1369 | | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1420 | 1378 | | |
1421 | 1379 | | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1426 | 1387 | | |
1427 | 1388 | | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
1439 | | - | |
| 1389 | + | |
1440 | 1390 | | |
1441 | 1391 | | |
1442 | 1392 | | |
1443 | 1393 | | |
1444 | 1394 | | |
1445 | | - | |
1446 | | - | |
| 1395 | + | |
| 1396 | + | |
1447 | 1397 | | |
1448 | 1398 | | |
1449 | 1399 | | |
| |||
1456 | 1406 | | |
1457 | 1407 | | |
1458 | 1408 | | |
1459 | | - | |
1460 | | - | |
| 1409 | + | |
| 1410 | + | |
1461 | 1411 | | |
1462 | 1412 | | |
1463 | 1413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 44 | + | |
| 45 | + | |
55 | 46 | | |
56 | 47 | | |
57 | 48 | | |
| |||
70 | 61 | | |
71 | 62 | | |
72 | 63 | | |
73 | | - | |
74 | | - | |
75 | 64 | | |
76 | 65 | | |
77 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
94 | 129 | | |
0 commit comments