@Test public void prependTo_withMultipleColumns_prependsProperSql() { String[] columns = {"a", "b", "c"}; SelectImpl select = new SelectImpl(columns); RawSqlBuilder builder = new RawSqlBuilderImpl(); select.prependTo(builder); assertThat(builder.toString(), is("SELECT a,b,c")); }
@Override public void prependTo(@NotNull final RawSqlBuilder builder) { for (int i = mColumns.length - 1; i >= 0; i--) { builder.prepend(mColumns[i]); if (i > 0) { builder.prepend(','); } } builder.prepend("SELECT "); }
SelectImpl extends BaseSqlPart implements Select { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { for (int i = mColumns.length - 1; i >= 0; i--) { builder.prepend(mColumns[i]); if (i > 0) { builder.prepend(','); } } builder.prepend("SELECT "); } }
SelectImpl extends BaseSqlPart implements Select { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { for (int i = mColumns.length - 1; i >= 0; i--) { builder.prepend(mColumns[i]); if (i > 0) { builder.prepend(','); } } builder.prepend("SELECT "); } SelectImpl(@NotNull final String... columns); }
SelectImpl extends BaseSqlPart implements Select { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { for (int i = mColumns.length - 1; i >= 0; i--) { builder.prepend(mColumns[i]); if (i > 0) { builder.prepend(','); } } builder.prepend("SELECT "); } SelectImpl(@NotNull final String... columns); @NotNull @Override SelectFrom from(@NotNull final String tableName); @Override void prependTo(@NotNull final RawSqlBuilder builder); @Nullable @Override SqlPart previous(); }
SelectImpl extends BaseSqlPart implements Select { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { for (int i = mColumns.length - 1; i >= 0; i--) { builder.prepend(mColumns[i]); if (i > 0) { builder.prepend(','); } } builder.prepend("SELECT "); } SelectImpl(@NotNull final String... columns); @NotNull @Override SelectFrom from(@NotNull final String tableName); @Override void prependTo(@NotNull final RawSqlBuilder builder); @Nullable @Override SqlPart previous();  }