Skip to content

Add SQLite database compatibility for all queries#1338

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/update-plugin-queries-sqlite
Draft

Add SQLite database compatibility for all queries#1338
Copilot wants to merge 3 commits intodevelopfrom
copilot/update-plugin-queries-sqlite

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 15, 2026

Plugin queries use MySQL-specific syntax that fails on WordPress SQLite installations. This adds cross-database compatibility for SQLite Database Integration plugin support.

New Helper Functions

  • edac_is_sqlite() - Detects SQLite via DB_ENGINE constant, SQLITE_DB_DROPIN_VERSION, or driver class inspection
  • edac_table_exists() - Uses sqlite_master for SQLite, SHOW TABLES LIKE for MySQL

Query Compatibility Fixes

  • class-update-database.php - Replaced SHOW TABLES LIKE with edac_table_exists()
  • class-purge-post-data.php - MySQL multi-table DELETE (DELETE T1,T2 FROM ... JOIN) replaced with separate DELETE statements for SQLite
  • class-issues-query.php - MySQL COUNT(DISTINCT col1, col2) replaced with concatenation for SQLite
// SQLite-compatible distinct count
if ( edac_is_sqlite() ) {
    $this->query['select'] = "SELECT COUNT( DISTINCT rule || '|' || object ) ";
} else {
    $this->query['select'] = 'SELECT COUNT( DISTINCT rule, object ) ';
}

Tests

Added SqliteCompatibilityTest.php covering the new helper functions.

Original prompt

Make the queries in this plugin all support sql lite


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 15, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits January 15, 2026 21:32
Co-authored-by: pattonwebz <3902039+pattonwebz@users.noreply.github.com>
Co-authored-by: pattonwebz <3902039+pattonwebz@users.noreply.github.com>
Copilot AI changed the title [WIP] Update plugin queries to support SQLite Add SQLite database compatibility for all queries Jan 15, 2026
Copilot AI requested a review from pattonwebz January 15, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants