By longwave on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
12.1.x
Introduced in version:
12.1.0
Issue links:
Description:
DatabaseExceptionWrapper and its subclasses now carry a SqlExecutionInfo object in the readonly $info property. It has three properties:
sqlQuery: the SQL query string.placeholders: the placeholder values.options: the query options.
The format of the exception message has changed. The query is still appended to the driver message. Placeholder values are now on a single line, and runs of whitespace in the query are collapsed. Values that are not scalars show only their type.
Before:
SQLSTATE[42S02]: Base table or view not found: ...: SELECT * FROM "test" WHERE "name" = :name; Array
(
[:name] => Ringo
)
After:
SQLSTATE[42S02]: Base table or view not found: ...: SELECT * FROM "test" WHERE "name" = :name; [:name='Ringo']
Code that previously parsed the message may need updating. The driver message without the query is available from $exception->getPrevious()->getMessage(). The query and placeholders are available from $exception->info.
Impacts:
Module developers