-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
<bind> should behave like a local variable inside <foreach> #2754
Comments
Thank you for the report, @tsasaki609 . This is a duplicate of #575 actually. |
@harawata Thanks for the reply. |
Are you proposing to update the DTD? <foreach ...>
<if ...>
<bind ...> |
@harawata ,
|
Also related to mybatis#206 mybatis#575
…phase - Evaluated param values are stored in `ParameterMapping` and later used in DefaultParameterHandler - There is no change when processing RawSqlSource - Removed unused `injectionFilter` from TextSqlNode (mybatisgh-117) This should fix mybatis#2754 . This might also fix mybatis#206 and mybatis#575 , but with this patch, it still is not possible to invoke a method with parameter inside a parameter reference like `#{_parameter.mymethod(_parameter.value)}`. It might be possible to accept OGNL expression in a param reference (e.g. `#{${_parameter.mymethod(_parameter.value)}}`), but I'm not sure if that's a good idea.
We plan to address the original issue you reported in the next minor update 3.6.x (cf. #2760 ) |
I found the following problem and report it.
If I have time, I will fix it and create a pull request.
MyBatis version
3.5.11
Database vendor and version
SQLite3 (probably for any vendor)
Test case or example project
https://github.com/tsasaki609/mybatis-3-sscce-foreach-with-bind
Steps to reproduce
check out the example project and run
Expected result
09:44:57.720 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - ==> Preparing: SELECT count(*) FROM bar WHERE id IN ( ? , ? )
09:44:57.755 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - ==> Parameters: test001(String), test002(String)
09:44:57.787 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - <== Total: 1
2
Actual result
09:44:57.720 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - ==> Preparing: SELECT count(*) FROM bar WHERE id IN ( ? , ? )
09:44:57.755 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - ==> Parameters: test002(String), test002(String)
09:44:57.787 [main] DEBUG mybatis.sscce.foreach.with.bind.FooMapper.countBar - <== Total: 1
1
The text was updated successfully, but these errors were encountered: