以下是查询:
START TRANSACTION;
SET FOREIGN_KEY_CHECKS = 0;
SET UNIQUE_CHECKS = 0;
SET AUTOCOMMIT = 0;
INSERT INTO n2 (idbin,vertices) VALUES("0",2),("1",2);
SET UNIQUE_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 1;
COMMIT;
例外:
MySQL ERR: SQLException in gen_simple_graphs.cc(printSqlException) on line 404
MySQL ERR: 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 'SET FOREIGN_KEY_CHECKS = 0;SET UNIQUE_CHECKS = 0;SET AUTOCOMMIT = 0;INSERT INTO ' at line 1 (MySQL error code: 1064, SQLState: 42000 )
当我在MySQL工作台中运行相同的查询时,它完全正常。事实上,我在程序执行之前将查询打印到控制台,将其精确复制并粘贴到工作台中并且没有问题。
这就是直接从控制台看起来的样子:
START TRANSACTION;SET FOREIGN_KEY_CHECKS = 0;SET UNIQUE_CHECKS = 0;SET AUTOCOMMIT = 0;INSERT INTO n2 (idbin,vertices) VALUES("0",2),("1",2);SET UNIQUE_CHECKS = 1;SET FOREIGN_KEY_CHECKS = 1;COMMIT;
有什么想法吗?
答案 0 :(得分:0)
字符;
结束查询然后这意味着MySQL WorkBench IDE中的新语句但是在C ++中的内部查询是不允许的,因为这样变得更多查询/语句..并且您引发了错误。