Hi! I'm developing a component and for logging reasons to debug some potential difficult issues I'm logging the SQL query executed at some points of the component process.
An example query could be:
$query = $this->db->getQuery(true)
->select(
[
$this->db->quoteName('token'),
]
)
->from($this->db->quoteName('#__my_cool_component'))
->where($this->db->quoteName('id') . ' = :id')
->where($this->db->quoteName('state') . ' = 1')
->bind(':id', $id, ParameterType::INTEGER)
->setLimit($this->limit, $this->limitStart);
$this->db->setQuery($query);
$rows = $this->db->loadAssocList();
I want to log that query, but using $query->__toString() I get the query but without the actual values, I mean, I get the placeholders of the values, but no the values itself
SELECT `token`
FROM `#__my_cool_component`
WHERE `id` = :id AND `state` = 1 LIMIT 300, 100
In the query example, the ID value iterates from 1 to 5. ¿Can I get the exact query as executed in the MySQL server? with the :id placeholder replaced with the actual integer value?
Thanks!