This recipe shows how to create a component that will offer extended logging of all queries executed on any SQL-based datasource that supports the
EXPLAIN command (this recipe is designed to work with MySQL, but can be adapted to other SQL based datasources), and show that information when the appropriate debug setting is set.
To go through this recipe we need a sample table to work with. Create a table named
accounts, using the following SQL statement:
CREATE TABLE `accounts`( `id` INT UNSIGNED AUTO_INCREMENT NOT NULL, `email` VARCHAR(255) NOT NULL, PRIMARY KEY(`id`) );
Create a table named
profiles, using the following SQL statement:
CREATE TABLE `profiles`( `id` INT UNSIGNED AUTO_INCREMENT ...