/** * Gets the configuration object. * * @return the config, not null */ public ElSqlConfig getConfig() { return _fragments.getConfig(); }
/** * Gets the configuration object. * * @return the config, not null */ public ElSqlConfig getConfig() { return _fragments.getConfig(); }
@Override void toSQL(StringBuilder buf, SqlFragments fragments, SqlParams params, int[] loopIndex) { int offset = extractVariableOrLiteral(params, _offsetVariable); int fetchLimit = extractVariableOrLiteral(params, _fetchVariable); buf.append(fragments.getConfig().getPaging(offset, fetchLimit == Integer.MAX_VALUE ? 0 : fetchLimit)); }
@Override void toSQL(StringBuilder buf, SqlFragments fragments, SqlParams params, int[] loopIndex) { String var = applyLoopIndex(_variable, loopIndex); Object val = params.get(var); if (val == null) { buf.append("IS NULL "); } else { if (fragments.getConfig().isLikeWildcard(val.toString())) { buf.append("LIKE "); super.toSQL(buf, fragments, params, loopIndex); buf.append(fragments.getConfig().getLikeSuffix()); } else { buf.append("= "); super.toSQL(buf, fragments, params, loopIndex); } } }
/** * Applies the paging. * * @param selectToPage the contents of the enclosed block, not null * @param fragments the SQL fragments for context, not null * @param params the SQL arguments, not null */ String applyPaging(String selectToPage, SqlFragments fragments, SqlParams params) { int offset = extractVariableOrLiteral(params, _offsetVariable); int fetchLimit = extractVariableOrLiteral(params, _fetchVariable); return fragments.getConfig().addPaging(selectToPage, offset, fetchLimit == Integer.MAX_VALUE ? 0 : fetchLimit); }