ZF2-362: Quotation in Mysql SQL adapter

Description

When I create query with Select() and convert it into string it shows this

SELECT "user"."id" AS id, "user"."name" AS name FROM "user" WHERE "user"."email" = 'my@email.com';

I think for mysql syntax more correct way would be to use ` quote for table name and fields. And " to use for strings. Although it works this way, all syntax highlighters will highlight this as strings and this is important to make SQL visibility if you create lage project with build in SQL tracker.

I think the default quote for this have to be like this

SELECT user.id AS id, user.name AS name FROM user WHERE user.email = 'my@email.com';

Comments

To create the SQL string for mysql, you would need to do the following:


use Zend\Db\Sql\Select;
use Zend\Db\Adapter\Platform\Mysql as MysqlPlatform;

$select = new Select();
// ...
$sql = $select->toSqlString(new MysqlPlatform); // you can also get that from $adapter->platform;