db icon indicating copy to clipboard operation
db copied to clipboard

Add some id to SQL statements

Open uldisn opened this issue 6 years ago • 3 comments

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 ...;

uldisn avatar Jun 12 '19 07:06 uldisn

It's an interesting idea but it won't be added to Yii 2.x.

samdark avatar Jun 12 '19 08:06 samdark

I'll make pull request?

uldisn avatar Jun 12 '19 08:06 uldisn

For yiisoft/db? You can try but note that the package isn't finished yet.

samdark avatar Jun 12 '19 20:06 samdark

You can add info into log before exequte a query

$logger->log(LogLevel::INFO, '-- ID::carsInWay --', [$category]);
$command->setSql('SELECT ...')->execute();

Tigrov avatar Nov 22 '23 04:11 Tigrov