WordPress / WordPress/sqlite-database-integration

Align PDO error handling and diagnostics with PDO MySQL

Open
#473 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
363
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
7

Description

Problem

Error handling and diagnostic state in WP_MySQL_On_SQLite differ from PDO MySQL across public connection and statement operations.

Error-mode handling

Some operations delegate directly to the underlying SQLite connection, which remains in exception mode for internal use. As a result:

  • Raw SQLite PDOExceptions may escape under ERRMODE_SILENT and ERRMODE_WARNING.
  • The configured error mode may be ignored by transaction, attribute, and statement operations.
  • Connection or statement diagnostics may not be populated correctly.

Transaction-state errors such as “There is no active transaction” are separate and should continue to throw regardless of error mode.

Diagnostic lifecycle

Successful operations do not consistently update diagnostics according to PDO MySQL behavior. This is operation-specific:

  • lastInsertId() resets previous diagnostics to 00000.
  • Successful transaction operations preserve existing diagnostics.
Explicit transactions

A failed query() currently rolls back the active user transaction. PDO MySQL keeps the transaction active so the caller can decide whether to commit or roll it back.

Expected behavior

  • Apply the configured error mode to all public connection and statement operations.
  • Keep internal SQLite exception handling separate from caller-visible behavior.
  • Populate connection and statement diagnostics on failure.
  • Reset or preserve diagnostics after success according to PDO MySQL behavior for each operation.
  • Keep transaction-state errors throwing in every error mode.
  • Roll back only the failed statement’s internal transaction or savepoint.
  • Keep explicit user transactions active after statement errors.
  • Add coverage across public operations and all supported error modes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the WP_MySQL_On_SQLite public connection and statement operations, especially query(), lastInsertId(), transaction methods, and attribute handling. Compare their behavior with PDO MySQL across supported error modes, then add coverage showing correct diagnostics, transaction preservation, transaction-state exceptions, and operation-specific diagnostic reset or preservation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sqlite
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.