Commit b4abe36
Implement clean context-based charset error handling with exact MySQL compatibility
This commit replaces the workaround approach with clean architecture that passes
column and row context through Go context to eliminate <unknown> placeholders in
charset validation error messages.
Key improvements:
- Context enhancement pattern for passing column/row information
- Eliminates error recreation workarounds and string parsing
- Perfect MySQL error format matching including ASCII/hex display
- Comprehensive test coverage for all charset validation scenarios
- Follows existing GMS error handling patterns exactly
Changes:
- Add context keys for column name and row number in sql/types/strings.go
- Update formatInvalidByteForError to show ASCII chars and hex bytes like MySQL
- Enhance insert.go to set context before Convert() calls
- Remove error recreation workaround code
- Update test expectations to match correct MySQL behavior
- Add comprehensive unit tests for mixed ASCII/invalid byte scenarios
Fixes charset validation to match MySQL behavior exactly while maintaining
clean architecture principles and zero breaking changes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 325d513 commit b4abe36
File tree
5 files changed
+107
-52
lines changed- enginetest
- queries
- sql
- rowexec
- types
5 files changed
+107
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4501 | 4501 | | |
4502 | 4502 | | |
4503 | 4503 | | |
4504 | | - | |
| 4504 | + | |
4505 | 4505 | | |
4506 | 4506 | | |
4507 | 4507 | | |
4508 | 4508 | | |
4509 | 4509 | | |
4510 | 4510 | | |
4511 | | - | |
| 4511 | + | |
4512 | 4512 | | |
4513 | 4513 | | |
4514 | 4514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7532 | 7532 | | |
7533 | 7533 | | |
7534 | 7534 | | |
7535 | | - | |
| 7535 | + | |
7536 | 7536 | | |
7537 | 7537 | | |
7538 | 7538 | | |
7539 | | - | |
| 7539 | + | |
7540 | 7540 | | |
7541 | 7541 | | |
7542 | 7542 | | |
7543 | | - | |
| 7543 | + | |
7544 | 7544 | | |
7545 | 7545 | | |
7546 | 7546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
| |||
480 | 479 | | |
481 | 480 | | |
482 | 481 | | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
491 | 498 | | |
492 | 499 | | |
493 | 500 | | |
494 | | - | |
| 501 | + | |
| 502 | + | |
495 | 503 | | |
496 | 504 | | |
497 | 505 | | |
498 | 506 | | |
499 | | - | |
| 507 | + | |
| 508 | + | |
500 | 509 | | |
501 | 510 | | |
502 | 511 | | |
503 | 512 | | |
504 | 513 | | |
505 | 514 | | |
506 | 515 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
514 | 524 | | |
515 | | - | |
516 | | - | |
| 525 | + | |
| 526 | + | |
517 | 527 | | |
518 | | - | |
| 528 | + | |
| 529 | + | |
519 | 530 | | |
520 | 531 | | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
525 | 537 | | |
526 | 538 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
533 | 547 | | |
534 | | - | |
535 | | - | |
536 | | - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
537 | 553 | | |
538 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
539 | 578 | | |
540 | 579 | | |
| 580 | + | |
541 | 581 | | |
542 | 582 | | |
543 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
54 | 83 | | |
55 | 84 | | |
56 | 85 | | |
| |||
0 commit comments