0

This seems like it should be simple, but I was not able to find a way to do it: when using AdapterInterface, is it possible to get the final query that's built using the query builder?

For example,

$query = $this->connection
        ->select()
        ->from($this->resourceConnection->getTableName('table_name'))
        ->reset(\Zend_Db_Select::COLUMNS)
        ->columns('run_count')
        ->where($where);

where $this->connection is an instance of AdapterInterface.

How do I output (or even log) the actual query sent to MySQL?

0

You can use this to display Query

$query = $this->connection
        ->select()
        ->from($this->resourceConnection->getTableName('table_name'))
        ->reset(\Zend_Db_Select::COLUMNS)
        ->columns('run_count')
        ->where($where);
$query->__toString();exit();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.