I try to run a mysql statement via docker exec api -> https://docs.docker.com/engine/api/v1.41/#operation/ContainerExec
My Statement looks like this
{
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"DetachKeys": "ctrl-p,ctrl-q",
"Tty": false,
"Cmd": [
"bin/bash","-c", "mysql -uroot -ptesttest -e 'INSERT INTO `mandator_1`.`terminal` (`serialNumber`, `name`, `isActive`, `status`, `profileId`, `businessId`, `divisionId`, `ipAddress`, `groupId`, `setupVersion`, `macAddress`, `authType`) VALUES ('54321', '54321', '1', NULL, '1', '1', NULL, '172.45.17.197', '1', NULL, 'E4-F1-D3-FD', '2');' mandator_1"
]
}
but when i run the statement i get an error
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.17.197, 1, NULL, E4-F1-D3-FD, 2)' at line 1
i think my escaping is wrong but at which point?
CodePudding user response:
Try to change quote by double quote:
VALUES (\"54321\", \"54321\", \"1\", ...., \"2\");