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

关于OR关键字的支持 #633

Closed
MLeft opened this issue Mar 6, 2018 · 1 comment
Closed

关于OR关键字的支持 #633

MLeft opened this issue Mar 6, 2018 · 1 comment

Comments

@MLeft
Copy link

MLeft commented Mar 6, 2018

描述

已经看到Issue#501, 说目前已经支持了OR语句查询, 我使用了最新2.0.3代码, 还是报错

Which version of Sharding-Jdbc do you using?(您使用的Sharding-Jdbc版本为?)

最新 2.0.3

Expected behavior (您预期的结果是)

SQL: select * from PM_SYSPAR where (? is null OR PARCODE = ?) and (? is null OR PARCODE_SUB = ?)
实现对目标库的sql查询

Actual behavior (实际运行的结果是)

Caused by: io.shardingjdbc.core.parsing.parser.exception.SQLParsingUnsupportedException: Not supported token 'OR'.
	at io.shardingjdbc.core.parsing.lexer.LexerEngine.unsupportedIfEqual(LexerEngine.java:178)
	at io.shardingjdbc.core.parsing.parser.clause.WhereClauseParser.parseConditions(WhereClauseParser.java:76)
	at io.shardingjdbc.core.parsing.parser.clause.WhereClauseParser.parse(WhereClauseParser.java:68)

Steps to reproduce the behavior (可重现问题的操作步骤)

Please provide the reproduce example codes (such as github link),otherwise we will label the issue as Invalid and close it.(为了节省复现问题的时间,请务必提供可重现的代码,否则我们会将issue直接标记为invalid并关闭)

    @Select({
        "select * from PM_SYSPAR",
    	"where ",
        "     (#{parcode,jdbcType=VARCHAR} is null OR PARCODE = #{parcode,jdbcType=VARCHAR})",
        " and (#{parcodeSub,jdbcType=VARCHAR} is null OR PARCODE_SUB = #{parcodeSub,jdbcType=VARCHAR})"
    })
    @Results({
    	@Result(column="PARCODE", property="parcode", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="PARNAME", property="parname", jdbcType=JdbcType.VARCHAR),
        @Result(column="PARVALUE", property="parvalue", jdbcType=JdbcType.CLOB),
        @Result(column="PARCLASS", property="parclass", jdbcType=JdbcType.VARCHAR),
        @Result(column="PARSCOPE", property="parscope", jdbcType=JdbcType.VARCHAR),
        @Result(column="PARCODE_SUB", property="parcodeSub", jdbcType=JdbcType.VARCHAR),
        @Result(column="PARCODE_SUB_DESC", property="parcodeSubDesc", jdbcType=JdbcType.VARCHAR)
    })
    List<PmSyspar> checkPmSysparDuplicate(Map<String, Object> map);

Code should based on https://github.com/shardingjdbc/sharding-jdbc-example
(代码请基于 https://github.com/shardingjdbc/sharding-jdbc-example)

@terrymanu
Copy link
Member

terrymanu commented Mar 6, 2018

#501 is still opening. The status of finished features should be closed

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

No branches or pull requests

2 participants