Entity
Entity copied to clipboard
MySQL error and table name escaping
If there is a table in the database with a reserved name (for example, groups
), then I get an error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups' at line 1 (Connection: mysql, SQL: SHOW COLUMNS FROM groups;)
Change src/MySQL.php
and add name escaping:
'fields' => \DB::select("SHOW COLUMNS FROM `{$name}`;"),
'indexes' => \DB::select("SHOW INDEX FROM `{$name}`;"),