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中有中文导致报TokenMgrError: Lexical error #47

Open
QinYangFan opened this issue Dec 10, 2019 · 5 comments
Open

SQL中有中文导致报TokenMgrError: Lexical error #47

QinYangFan opened this issue Dec 10, 2019 · 5 comments

Comments

@QinYangFan
Copy link

QinYangFan commented Dec 10, 2019

在注解的SQL中有一个单引号引的中文,启动项目时(还未调用接口)报错
org.jfaster.mango.parser.TokenMgrError: Lexical error at line 1, column 35. Encountered: "\u4e2d" (20013), after : "'"
at org.jfaster.mango.parser.ParserTokenManager.getNextToken(ParserTokenManager.java:1443)
at org.jfaster.mango.parser.Parser.jj_ntk(Parser.java:1374)
at org.jfaster.mango.parser.Parser.parse(Parser.java:28)
at org.jfaster.mango.parser.SqlParser.parse(SqlParser.java:26)
at org.jfaster.mango.operator.OperatorFactory.getOperator(OperatorFactory.java:68)
at org.jfaster.mango.operator.Mango$MangoInvocationHandler$1.load(Mango.java:301)
at org.jfaster.mango.operator.Mango$MangoInvocationHandler$1.load(Mango.java:291)
at org.jfaster.mango.util.local.DoubleCheckCache.get(DoubleCheckCache.java:41)
at org.jfaster.mango.operator.Mango$MangoInvocationHandler.getOperator(Mango.java:335)
at org.jfaster.mango.operator.Mango.create(Mango.java:196)
at org.jfaster.mango.plugin.spring.AbstractMangoFactoryBean.getObject(AbstractMangoFactoryBean.java:40)

尝试将中文用Unicode编码,添加了反斜杠转义(‘\\’),后返回编码后的代码,怎么样才能返回中文

@QinYangFan QinYangFan changed the title SQL SQL中有中文导致报TokenMgrError: Lexical error Dec 10, 2019
@hsun924
Copy link

hsun924 commented Dec 10, 2019

SQL贴出来看看

@QinYangFan
Copy link
Author

SQL贴出来看看

@Sql("SELECT DISTINCT IFNULL(i.c_name, '中文' ) AS c_corp_name, dc.n_id, dc" +
".n_employee_id, " +
"dc.n_candidate_type, dc" +
".n_duty_type, dc.n_duty, dc.n_order_sn, dc.c_corp_id, dc.n_update_time, e.c_name AS c_employee_Name, e" +
".c_avatar_url, e.c_dept_ids FROM #table dc LEFT JOIN t_employee e ON e .n_employee_id = dc.n_employee_id" +
" LEFT JOIN t_interflow i ON i.c_corp_id = dc.c_corp_id WHERE 1=1 AND dc.n_candidate_type=:1 AND dc" +
".n_duty_type=:2 AND dc.c_corp_id = :3 ORDER BY dc.n_order_sn ")

@dontyang
Copy link

中文名称解决了吗

@tantom
Copy link

tantom commented Nov 13, 2020

期待能解决中文问题

@liangyanghe
Copy link
Member

下个小版本处理好中文问题哈

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

No branches or pull requests

5 participants