Problem
The MySQL-on-SQLite driver currently relies on PDO::ATTR_STRINGIFY_FETCHES being enabled for some of its internal metadata queries.
When stringification is disabled (the default for PDO SQLite), SQLite metadata values are returned as integers on current PHP versions. Several driver paths compare those values strictly against strings, so changing a public PDO fetch attribute can alter internal DDL and emulation behavior.
Known examples include:
- detecting temporary information-schema tables with
fetchColumn() === '1'
- restoring
PRAGMA foreign_keys only when its value is strictly '1'
- interpreting
NON_UNIQUE only when its value is strictly '0'
- reconstructing columns and indexes by comparing
notnull, pk, and unique metadata to string values
This was observed while simplifying the driver API in #449. With PDO::ATTR_STRINGIFY_FETCHES disabled, translation tests failed because unique indexes were recreated as non-unique and foreign-key state handling was skipped.
WordPress and the MySQL binary protocol adapter may still choose to enable stringified fetches for their outward compatibility. The driver's internal correctness should not depend on that caller-facing setting.
Expected behavior
- Normalize or cast internal SQLite metadata independently of
PDO::ATTR_STRINGIFY_FETCHES.
- Produce identical DDL, index, foreign-key, and information-schema behavior whether stringified fetches are enabled or disabled.
- Continue honoring
PDO::ATTR_STRINGIFY_FETCHES for result values returned through the public PDO-compatible API.
- Add coverage for both attribute states, including unique index reconstruction and foreign-key handling.
Problem
The MySQL-on-SQLite driver currently relies on
PDO::ATTR_STRINGIFY_FETCHESbeing enabled for some of its internal metadata queries.When stringification is disabled (the default for PDO SQLite), SQLite metadata values are returned as integers on current PHP versions. Several driver paths compare those values strictly against strings, so changing a public PDO fetch attribute can alter internal DDL and emulation behavior.
Known examples include:
fetchColumn() === '1'PRAGMA foreign_keysonly when its value is strictly'1'NON_UNIQUEonly when its value is strictly'0'notnull,pk, anduniquemetadata to string valuesThis was observed while simplifying the driver API in #449. With
PDO::ATTR_STRINGIFY_FETCHESdisabled, translation tests failed because unique indexes were recreated as non-unique and foreign-key state handling was skipped.WordPress and the MySQL binary protocol adapter may still choose to enable stringified fetches for their outward compatibility. The driver's internal correctness should not depend on that caller-facing setting.
Expected behavior
PDO::ATTR_STRINGIFY_FETCHES.PDO::ATTR_STRINGIFY_FETCHESfor result values returned through the public PDO-compatible API.