db
db copied to clipboard
Add some id to SQL statements
Reviewing the executed SQL statements in the debug toolbar or SQL log file is difficult to identify where they created. It would be very convenient to add id to the beginning. For example:
$sql = '
-- ID::carsInWay --
SELECT ...;
It's an interesting idea but it won't be added to Yii 2.x.
I'll make pull request?
For yiisoft/db? You can try but note that the package isn't finished yet.
You can add info into log before exequte a query
$logger->log(LogLevel::INFO, '-- ID::carsInWay --', [$category]);
$command->setSql('SELECT ...')->execute();