Skip to content

<bind> should behave like a local variable inside <foreach> #2754

Closed
@tsasaki609

Description

@tsasaki609

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions