Problem
WP_MySQL_On_SQLite forwards numeric PDO constructor options and most setAttribute() calls to the underlying SQLite PDO connection. Setting PDO::ATTR_CASE or PDO::ATTR_ORACLE_NULLS therefore changes internal query results as well as caller-visible results.
For PDO::ATTR_CASE, constructing the driver with PDO::CASE_LOWER lowercases keys returned by internal INFORMATION_SCHEMA queries. Driver code expects canonical keys such as COLUMN_NAME, so a subsequent CREATE TABLE emits an undefined-key warning and fails.
PDO::ATTR_ORACLE_NULLS can silently corrupt schema metadata. With PDO::NULL_TO_STRING, even CREATE TABLE t (id INT PRIMARY KEY) creates the SQLite column with DEFAULT ''. With PDO::NULL_EMPTY_STRING, internal metadata fields become null and operations such as SHOW CREATE TABLE fail.
Proposed solution
Treat both attributes as caller-visible wrapper state, similarly to PDO::ATTR_ERRMODE:
- Track the requested case and Oracle null modes in
WP_MySQL_On_SQLite and expose them through setAttribute() and getAttribute().
- Keep the underlying SQLite connection at
PDO::CASE_NATURAL and PDO::NULL_NATURAL for internal queries.
- Apply the requested modes only to caller-visible result statements, including
SELECT, SHOW, DESCRIBE, and synthesized result sets.
- For
PDO::ATTR_CASE, scope the requested mode around preparing and executing result statements, then restore PDO::CASE_NATURAL in a finally block. PDO captures folded result-column names when a statement is executed.
- For
PDO::ATTR_ORACLE_NULLS, apply the requested null conversion in the result-statement layer. PDO SQLite consults the connection-level setting when rows are fetched, so temporarily changing it only during execution is insufficient and leaving it enabled would affect later internal queries.
Add coverage for constructor options and runtime attribute changes using PDO::CASE_LOWER, PDO::CASE_UPPER, PDO::NULL_TO_STRING, and PDO::NULL_EMPTY_STRING. Verify fetch modes, associative and object results, getColumnMeta(), DDL and schema reconstruction, SHOW CREATE TABLE, and behavior across the supported PHP versions.
This is a follow-up to #471.
Problem
WP_MySQL_On_SQLiteforwards numeric PDO constructor options and mostsetAttribute()calls to the underlying SQLite PDO connection. SettingPDO::ATTR_CASEorPDO::ATTR_ORACLE_NULLStherefore changes internal query results as well as caller-visible results.For
PDO::ATTR_CASE, constructing the driver withPDO::CASE_LOWERlowercases keys returned by internal INFORMATION_SCHEMA queries. Driver code expects canonical keys such asCOLUMN_NAME, so a subsequentCREATE TABLEemits an undefined-key warning and fails.PDO::ATTR_ORACLE_NULLScan silently corrupt schema metadata. WithPDO::NULL_TO_STRING, evenCREATE TABLE t (id INT PRIMARY KEY)creates the SQLite column withDEFAULT ''. WithPDO::NULL_EMPTY_STRING, internal metadata fields become null and operations such asSHOW CREATE TABLEfail.Proposed solution
Treat both attributes as caller-visible wrapper state, similarly to
PDO::ATTR_ERRMODE:WP_MySQL_On_SQLiteand expose them throughsetAttribute()andgetAttribute().PDO::CASE_NATURALandPDO::NULL_NATURALfor internal queries.SELECT,SHOW,DESCRIBE, and synthesized result sets.PDO::ATTR_CASE, scope the requested mode around preparing and executing result statements, then restorePDO::CASE_NATURALin afinallyblock. PDO captures folded result-column names when a statement is executed.PDO::ATTR_ORACLE_NULLS, apply the requested null conversion in the result-statement layer. PDO SQLite consults the connection-level setting when rows are fetched, so temporarily changing it only during execution is insufficient and leaving it enabled would affect later internal queries.Add coverage for constructor options and runtime attribute changes using
PDO::CASE_LOWER,PDO::CASE_UPPER,PDO::NULL_TO_STRING, andPDO::NULL_EMPTY_STRING. Verify fetch modes, associative and object results,getColumnMeta(), DDL and schema reconstruction,SHOW CREATE TABLE, and behavior across the supported PHP versions.This is a follow-up to #471.