Similarly to the postgres issue, if I switch to mysql2 the query is generated with backticks, something that mysql appreciates:
SELECT storage_locations.id, items.id AS item_id, storage_locations.identifier, accounts.balance, zones.display_name AS zone_display_name FROM `items` INNER JOIN `item_placements` ON `item_placements`.`item_id` = `items`.`id` INNER JOIN `accounts` ON `accounts`.`identifier` = `item_placements`.`id` AND `accounts`.`category` = 'AVAILABLE' AND `accounts`.`account_type` = 'ITEM_PLACEMENT' INNER JOIN `storage_locations` ON `storage_locations`.`id` = `item_placements`.`storage_location_id` INNER JOIN `zones` ON `zones`.`id` = `storage_locations`.`zone_id` WHERE `items`.`id` IN (1) AND (accounts.balance > 0) AND (storage_locations.type = 'BinLocation') LIMIT 1
This time around, atom console reports this error:
Error: Parse error on line 2: Unexpected 'INNER' {stack: (...), message: "Parse error on line 2: Unexpected 'INNER'"}
Again, SQLBeautifier to the resque:
SELECT storage_locations.id,
items.id AS item_id,
storage_locations.identifier,
accounts.balance,
zones.display_name AS zone_display_name
FROM `items`
INNER JOIN `item_placements` ON `item_placements`.`item_id` = `items`.`id`
INNER JOIN `accounts` ON `accounts`.`identifier` = `item_placements`.`id`
AND `accounts`.`category` = 'AVAILABLE'
AND `accounts`.`account_type` = 'ITEM_PLACEMENT'
INNER JOIN `storage_locations` ON `storage_locations`.`id` = `item_placements`.`storage_location_id`
INNER JOIN `zones` ON `zones`.`id` = `storage_locations`.`zone_id`
WHERE `items`.`id` IN (1)
AND (accounts.balance > 0)
AND (storage_locations.type = 'BinLocation') LIMIT 1
Similarly to the postgres issue, if I switch to mysql2 the query is generated with backticks, something that mysql appreciates:
This time around, atom console reports this error:
Error: Parse error on line 2: Unexpected 'INNER' {stack: (...), message: "Parse error on line 2: Unexpected 'INNER'"}
Again, SQLBeautifier to the resque: