Source:
<code>protected void createPreparedStatement(Connection db) throws SQLException { if (increasingColumn != null && increasingColumn.isEmpty()) { increasingColumn = JdbcUtils.getAutoincrementColumn(db, name); } String quoteString = JdbcUtils.getIdentifierQuoteString(db); StringBuilder builder = new StringBuilder(); builder.append("SELECT * FROM " + quoteString); builder.append(name); builder.append(quoteString); if (increasingColumn != null && timestampColumn != null) { builder.append(" WHERE ("); <START> builder.append(quoteString); <END> builder.append(timestampColumn); builder.append(quoteString); builder.append(" = ? AND "); builder.append(quoteString); builder.append(increasingColumn); builder.append(quoteString); builder.append(" > ?"); builder.append(") OR "); builder.append(quoteString); builder.append(timestampColumn); builder.append(quoteString); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(quoteString); builder.append(timestampColumn); builder.append(quoteString); builder.append(","); builder.append(quoteString); builder.append(increasingColumn); builder.append(quoteString); builder.append(" ASC"); } else if (increasingColumn != null) { builder.append(" WHERE "); builder.append(quoteString); builder.append(increasingColumn); builder.append(quoteString); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(quoteString); builder.append(increasingColumn); builder.append(quoteString); builder.append(" ASC"); } else if (timestampColumn != null) { builder.append(" WHERE "); builder.append(quoteString); builder.append(timestampColumn); builder.append(quoteString); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(quoteString); builder.append(timestampColumn); builder.append(quoteString); builder.append(" ASC"); } stmt = db.prepareStatement(builder.toString()); }</code><technical_language>I in is a utility function quoteIdentifier(String identifier) returns a quoted string. I suspect more readable error-prone</technical_language>

Target:
protected void createPreparedStatement(Connection db) throws SQLException { if (increasingColumn != null && increasingColumn.isEmpty()) { increasingColumn = JdbcUtils.getAutoincrementColumn(db, name); } String quoteString = JdbcUtils.getIdentifierQuoteString(db); StringBuilder builder = new StringBuilder(); builder.append("SELECT * FROM "); builder.append(JdbcUtils.quoteString(name, quoteString)); if (increasingColumn != null && timestampColumn != null) { builder.append(" WHERE ("); builder.append(JdbcUtils.quoteString(timestampColumn, quoteString)); builder.append(" = ? AND "); builder.append(JdbcUtils.quoteString(increasingColumn, quoteString)); builder.append(" > ?"); builder.append(") OR "); builder.append(JdbcUtils.quoteString(timestampColumn, quoteString)); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(JdbcUtils.quoteString(timestampColumn, quoteString)); builder.append(","); builder.append(JdbcUtils.quoteString(increasingColumn, quoteString)); builder.append(" ASC"); } else if (increasingColumn != null) { builder.append(" WHERE "); builder.append(JdbcUtils.quoteString(increasingColumn, quoteString)); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(JdbcUtils.quoteString(increasingColumn, quoteString)); builder.append(" ASC"); } else if (timestampColumn != null) { builder.append(" WHERE "); builder.append(JdbcUtils.quoteString(timestampColumn, quoteString)); builder.append(" > ?"); builder.append(" ORDER BY "); builder.append(JdbcUtils.quoteString(timestampColumn, quoteString)); builder.append(" ASC"); } stmt = db.prepareStatement(builder.toString()); }