Slick - MySQL syntax error

I am using Play Framework (2.3.1) along with Slick (play-slick version 0.8.0-M1) and MySQL Database (5.5.28).

One of my queries results in a MySQLSyntaxErrorException:

Preparing statement: select x2."id", x2."course_id", x2."trainee_id", x2."transaction_id" from "trainee_grouptraining_GroupBooking" x2 where x2."course_id" = 1

The problem is with double quotes, as other queries work very well and they use single quotes, such as:

Preparing statement: select x2.`id`, x2.`courseLanguage`, x2.`date`, x2.`description`, x2.`duration`, x2.`kind`, x2.`maxParticipants`, x2.`name`, x2.`courseType_id`, x2.`trainer_id` from `Course` x2 where x2.`id` = 1

What can I do about this?

+4
source share
2 answers

I assume that you are importing

scala.slick.driver.JdbcDriver.simple._

You should import

scala.slick.driver.MySQLDriver.simple._

instead.

+8
source

MySQL backticks . SQL- ANSI_QUOTES,

ANSI_QUOTES

" (,` quot ), . " ` " . ANSI_QUOTES, , , .

.

0

Source: https://habr.com/ru/post/1547568/


All Articles