Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

表名或字段是关键字,生成sql 运行报错 #17

Closed
k631583871 opened this issue May 10, 2018 · 1 comment
Closed

表名或字段是关键字,生成sql 运行报错 #17

k631583871 opened this issue May 10, 2018 · 1 comment
Labels

Comments

@k631583871
Copy link

Bug

当数据库字段或表名使用了mysql的关键字的时候,生成的sql在运行的时候会报错,
例如:name,order
期望在字段前后添加上 ` 解决这个问题

@spawpaw spawpaw added the bug label May 10, 2018
spawpaw added a commit that referenced this issue May 10, 2018
you can config it in `DAO Setting`,
just select a delimiter character and the keywords will auto be delimited.
@JohnChuang33
Copy link

不如说,数据库表名在使用了关键字之后,直接在终端连接数据库输SQL操作的时候也会报错。所以说与其说是bug不如说是mysql本身的限制

CREATE TABLE IF NOT EXISTS `order` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `customer_id` INT NULL,
  `datetime` DATETIME NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB;
INSERT INTO order VALUES(NULL,24,'2014-12-10 11:00:00');

亲自测试当表名和插入语句改成orders的时候能用,而INSERT语句中

INSERT INTO 'order' VALUES(NULL,24,'2014-12-10 11:00:00');

这种形式也是会报错的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants