Commit c92910c
authored
Implement FROM_BASE64() and TO_BASE64() MySQL functions (#326)
## Summary
This adds support for MySQL's `FROM_BASE64()` and `TO_BASE64()`
functions, allowing SQL queries to encode and decode base64 data.
Both functions are implemented as SQLite user-defined functions backed
by PHP's `base64_encode()` and `base64_decode()`. Because they're
registered through
`WP_SQLite_PDO_User_Defined_Functions::register_for()`, they work with
both the legacy and AST-based drivers automatically.
`FROM_BASE64()` returns `NULL` for `NULL` or invalid base64 input.
`TO_BASE64()` returns `NULL` for `NULL` input.
## Test plan
- Run `composer run test -- --filter 'testFromBase64|testToBase64'`
- Verify basic encoding/decoding, NULL handling, empty string handling,
and round-trip correctness2 files changed
Lines changed: 76 additions & 0 deletions
File tree
- tests
- wp-includes/sqlite
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11363 | 11363 | | |
11364 | 11364 | | |
11365 | 11365 | | |
| 11366 | + | |
| 11367 | + | |
| 11368 | + | |
| 11369 | + | |
| 11370 | + | |
| 11371 | + | |
| 11372 | + | |
| 11373 | + | |
| 11374 | + | |
| 11375 | + | |
| 11376 | + | |
| 11377 | + | |
| 11378 | + | |
| 11379 | + | |
| 11380 | + | |
| 11381 | + | |
| 11382 | + | |
| 11383 | + | |
| 11384 | + | |
| 11385 | + | |
| 11386 | + | |
| 11387 | + | |
| 11388 | + | |
| 11389 | + | |
| 11390 | + | |
| 11391 | + | |
| 11392 | + | |
| 11393 | + | |
| 11394 | + | |
| 11395 | + | |
| 11396 | + | |
| 11397 | + | |
| 11398 | + | |
| 11399 | + | |
| 11400 | + | |
| 11401 | + | |
11366 | 11402 | | |
11367 | 11403 | | |
11368 | 11404 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
667 | 669 | | |
668 | 670 | | |
669 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
670 | 710 | | |
671 | 711 | | |
672 | 712 | | |
| |||
0 commit comments