mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-22 00:52:16 -05:00
Add QueryMapper.noBind, which is skipped if sent in as one of the bindObjects
This commit is contained in:
parent
1850272d64
commit
a7e159b172
@ -192,7 +192,7 @@ public class ListQueryMapper extends QueryMapper {
|
|||||||
private static StringBuilder recursiveReplace(final StringBuilder sb, final Object... bindObjects) {
|
private static StringBuilder recursiveReplace(final StringBuilder sb, final Object... bindObjects) {
|
||||||
if (bindObjects != null && bindObjects.length > 0) {
|
if (bindObjects != null && bindObjects.length > 0) {
|
||||||
for (Object o : bindObjects) {
|
for (Object o : bindObjects) {
|
||||||
if (o != null) {
|
if (o != null && o != QueryMapper.noBind) {
|
||||||
if (o instanceof InList.InListObject) {
|
if (o instanceof InList.InListObject) {
|
||||||
final int startIndex = sb.indexOf(inListReplace);
|
final int startIndex = sb.indexOf(inListReplace);
|
||||||
if (startIndex < -1)
|
if (startIndex < -1)
|
||||||
|
@ -12,6 +12,8 @@ import static com.moparisthebest.jdbc.TryClose.tryClose;
|
|||||||
|
|
||||||
public class QueryMapper implements Closeable {
|
public class QueryMapper implements Closeable {
|
||||||
|
|
||||||
|
public static final Object noBind = new Object();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try{
|
try{
|
||||||
final Class<?> ensureContext = Class.forName(System.getProperty("QueryMapper.ensureContext.class", "com.gcl.containerless.EnsureContext"));
|
final Class<?> ensureContext = Class.forName(System.getProperty("QueryMapper.ensureContext.class", "com.gcl.containerless.EnsureContext"));
|
||||||
@ -203,7 +205,7 @@ public class QueryMapper implements Closeable {
|
|||||||
if (bindObjects != null && bindObjects.length > 0) {
|
if (bindObjects != null && bindObjects.length > 0) {
|
||||||
for (Object o : bindObjects) {
|
for (Object o : bindObjects) {
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
if (o == InList.InListObject.empty) {
|
if (o == InList.InListObject.empty || o == noBind) {
|
||||||
continue; // ignore
|
continue; // ignore
|
||||||
} else if (o instanceof BindInList.BindInListObject) {
|
} else if (o instanceof BindInList.BindInListObject) {
|
||||||
if (((BindInList.BindInListObject) o).getBindObjects() != null)
|
if (((BindInList.BindInListObject) o).getBindObjects() != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user