-
Notifications
You must be signed in to change notification settings - Fork 59
Comparing changes
Open a pull request
base repository: WordPress/sqlite-database-integration
base: v2.2.18
head repository: WordPress/sqlite-database-integration
compare: v2.2.19
- 20 commits
- 13 files changed
- 5 contributors
Commits on Mar 6, 2026
-
Configuration menu - View commit details
-
Copy full SHA for cef3f97 - Browse repository at this point
Copy the full SHA cef3f97View commit details
Commits on Mar 10, 2026
-
Implement FROM_BASE64() and TO_BASE64() MySQL functions
These functions allow encoding and decoding base64 data in SQL queries, matching the behavior of their MySQL counterparts. They are registered as SQLite user-defined functions backed by PHP's base64_encode() and base64_decode(), so both the legacy and AST-based drivers can use them. FROM_BASE64() returns NULL for NULL or invalid base64 input. TO_BASE64() returns NULL for NULL input.
Configuration menu - View commit details
-
Copy full SHA for 7134c20 - Browse repository at this point
Copy the full SHA 7134c20View commit details
Commits on Mar 11, 2026
-
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 correctness
Configuration menu - View commit details
-
Copy full SHA for c92910c - Browse repository at this point
Copy the full SHA c92910cView commit details -
fix: query() returned null instead of 0 for statements affecting 0 ro…
…ws (#325) ### Summary Fixes #322 WP_SQLite_Driver::query() returned null instead of 0 for statements affecting zero rows (e.g., DELETE FROM x WHERE id = 1 when no matching row exists). This caused wpdb::query() to also return null, breaking its documented contract of returning int|bool. ### Problem In WP_SQLite_Driver::query(), the return logic for non-SELECT queries was: 1. rowCount() > 0 - return row count 2. Otherwise - return null This meant any DELETE, UPDATE, INSERT statement with 0 affected rows returned null instead of 0. ### Fix Simplified the logic to always return rowCount() for non-SELECT statements. DELETE / UPDATE / INSERT will now correctly returns 0 instead of null when no rows affected. CREATE / ALTER / DROP / TRUNCATE now returns 0 instead of null, but wp-includes/sqlite/class-wp-sqlite-db.php never reads this value for these queries (it returns true unconditionally at line 448-449) ### Testing - Added testDeleteReturnsZeroAffectedRowsWhenNoMatchingRows - verifies DELETE returns 0 when no rows match. - Added testUpdateReturnsZeroAffectedRowsWhenNoMatchingRows - verifies UPDATE returns 0 when no rows match. - Updated existing test assertions from assertNull to assertSame( 0, ... ) to reflect the corrected behaviour - Full test suite passes (777 tests)
Configuration menu - View commit details
-
Copy full SHA for 3a5c48c - Browse repository at this point
Copy the full SHA 3a5c48cView commit details
Commits on Mar 12, 2026
-
Accept zero dates when NO_ZERO_DATE and NO_ZERO_IN_DATE SQL modes are…
… off MySQL's behavior around zero dates ('0000-00-00') and dates with zero parts ('2020-00-15') depends on two SQL modes: NO_ZERO_DATE and NO_ZERO_IN_DATE. Both are enabled by default in MySQL 8.0, but applications can disable them. Previously, the SQLite driver always rejected zero dates through SQLite's DATE()/DATETIME() functions, which return NULL for such values. This caused incorrect errors when strict mode was on but the zero-date modes were off. Now the CASE expression in cast_value_for_saving() checks the active SQL modes and inserts additional WHEN clauses to accept zero dates when appropriate. The translate_datetime_literal() method also preserves dates with zero month/day parts when NO_ZERO_IN_DATE is off, instead of truncating them via strtotime().Configuration menu - View commit details
-
Copy full SHA for f8c58de - Browse repository at this point
Copy the full SHA f8c58deView commit details -
Inline zero-date mode checks into the CASE expression
Instead of conditionally building $zero_date_whens in PHP, the WHEN clauses are always present in the CASE statement with the SQL mode check embedded as a literal boolean (AND NOT 0/1). This keeps the generated SQL structure consistent regardless of active modes.
Configuration menu - View commit details
-
Copy full SHA for e962cdf - Browse repository at this point
Copy the full SHA e962cdfView commit details -
Fix PHPCS code style violations
One argument per line in the sprintf call, align equals signs, and use single quotes for CREATE TABLE string in tests.
Configuration menu - View commit details
-
Copy full SHA for 025b03d - Browse repository at this point
Copy the full SHA 025b03dView commit details -
Use strtr with named placeholders for the zero-date CASE expression
Replace sprintf with strtr so each substituted value appears once in the argument list and the template reads like annotated SQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for be86458 - Browse repository at this point
Copy the full SHA be86458View commit details -
Fix the zero-date CASE expression to compare the function call result…
…, not the raw value The strtr refactor accidentally changed `WHEN $function_call > '0'` to `WHEN {value} > '0'`, comparing the wrong operand and breaking date validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Configuration menu - View commit details
-
Copy full SHA for 7763982 - Browse repository at this point
Copy the full SHA 7763982View commit details -
Test that UPDATE rejects zero dates in strict mode
Verify that UPDATE statements produce errors for zero dates and zero-in-dates when strict mode is combined with NO_ZERO_DATE or NO_ZERO_IN_DATE, matching the existing INSERT rejection tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for cc3c494 - Browse repository at this point
Copy the full SHA cc3c494View commit details -
Test zero dates in SELECT and fix YEAR/MONTH/DAY for zero dates
Add tests verifying that stored zero dates and zero-in-dates can be selected, compared, ordered, and filtered – matching MySQL behavior. Fix YEAR(), MONTH(), and DAY() functions to return 0 for zero date parts. Previously, strtotime() couldn't parse dates like '0000-00-00' or '2020-00-15', producing wrong results. Now the date parts are extracted directly from the string when possible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 13c8a34 - Browse repository at this point
Copy the full SHA 13c8a34View commit details -
Fix PHPCS: use single quotes for SQL string without interpolation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 8e2c32f - Browse repository at this point
Copy the full SHA 8e2c32fView commit details -
Restore PHP datetime.format.php documentation comments
The PHP manual references for format specifiers used by gmdate() were accidentally removed when adding zero-date handling. These comments document why specific format characters (n, Y, j) are used in the fallback path and should be preserved.
Configuration menu - View commit details
-
Copy full SHA for c199ff8 - Browse repository at this point
Copy the full SHA c199ff8View commit details -
Anchor date-extraction regexps with ^
Add ^ anchors to the YEAR/MONTH/DAY regex patterns so they only match date strings starting at the beginning of the input, not arbitrary substrings.
Configuration menu - View commit details
-
Copy full SHA for 131d3b2 - Browse repository at this point
Copy the full SHA 131d3b2View commit details -
Accept zero dates when NO_ZERO_DATE SQL mode is off (#327)
## Summary MySQL controls zero-date acceptance through two SQL modes: `NO_ZERO_DATE` and `NO_ZERO_IN_DATE`. Both are on by default, but applications can turn them off to allow values like `'0000-00-00 00:00:00'` or `'2020-00-15'`. The SQLite driver wasn't honoring these modes – SQLite's `DATE()`/`DATETIME()` functions return NULL for zero dates, so they always fell through to the strict-mode error, even when the zero-date modes were disabled. This PR adds zero-date acceptance checks to `cast_value_for_saving()` that inspect the active SQL modes before rejecting a date. When `NO_ZERO_DATE` is off (or on without strict mode), all-zero dates pass through. When `NO_ZERO_IN_DATE` is off, dates with zero month/day parts like `'2020-00-15'` are accepted too. The `translate_datetime_literal()` method is also updated to preserve zero-part dates instead of truncating them via `strtotime()`. The behavior matrix now matches MySQL's documentation: | Mode combination | `'0000-00-00'` | `'2020-00-15'` | |---|---|---| | Both modes off | Accepted | Accepted | | Mode on, non-strict | Accepted (warning in MySQL) | Stored as `'0000-00-00'` | | Mode on + strict | Error | Error | ## Test plan - [x] 12 new PHPUnit tests covering all combinations of NO_ZERO_DATE × NO_ZERO_IN_DATE × strict mode - [x] Full test suite passes (772 tests, 0 failures) - [ ] Review that WordPress core's `test_insert_empty_post_date` still works with default modes
Configuration menu - View commit details
-
Copy full SHA for d87bc8f - Browse repository at this point
Copy the full SHA d87bc8fView commit details
Commits on Mar 18, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 3fa8152 - Browse repository at this point
Copy the full SHA 3fa8152View commit details
Commits on Mar 19, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 5e17388 - Browse repository at this point
Copy the full SHA 5e17388View commit details -
Configuration menu - View commit details
-
Copy full SHA for c4a9241 - Browse repository at this point
Copy the full SHA c4a9241View commit details -
Add SQLite database application ID and new consistent file extension (#…
…329) This PR adds the `3948349` integer as the [SQLite Application ID](https://sqlite.org/fileformat.html#application_id) that is standard procedure to take when a SQLite database is used as an application file format[^1]. A new consistent file extension has been chosen. 1. `PRAGMA application_id = SQLITE_DB_APPLICATION_ID` is set for new and old databases 2. New databases are created with the new file extension 3. Legacy files are renamed for backward compatibility [^1]: https://sqlite.org/appfileformat.html
Configuration menu - View commit details
-
Copy full SHA for 75544c2 - Browse repository at this point
Copy the full SHA 75544c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7be6b9c - Browse repository at this point
Copy the full SHA 7be6b9cView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v2.2.18...v2.2.19