Merge remote-tracking branch 'origin/pr/1468'

master
Andrew DeMaria 5 years ago
commit 03a607d659
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 10
      airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java
  2. 4
      airsonic-main/src/main/java/org/airsonic/player/dao/MediaFileDao.java

@ -102,16 +102,6 @@ public class AbstractDao {
return result; return result;
} }
protected <T> List<T> namedQueryWithLimit(String sql, RowMapper<T> rowMapper, Map<String, Object> args, int limit) {
long t = System.nanoTime();
JdbcTemplate jdbcTemplate = new JdbcTemplate(daoHelper.getDataSource());
jdbcTemplate.setMaxRows(limit);
NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
List<T> result = namedTemplate.query(sql, args, rowMapper);
log(sql, t);
return result;
}
protected List<String> queryForStrings(String sql, Object... args) { protected List<String> queryForStrings(String sql, Object... args) {
long t = System.nanoTime(); long t = System.nanoTime();
List<String> result = getJdbcTemplate().queryForList(sql, args, String.class); List<String> result = getJdbcTemplate().queryForList(sql, args, String.class);

@ -592,7 +592,9 @@ public class MediaFileDao extends AbstractDao {
query += " order by rand()"; query += " order by rand()";
return namedQueryWithLimit(query, rowMapper, args, criteria.getCount()); query += " limit " + criteria.getCount();
return namedQuery(query, rowMapper, args);
} }
public int getAlbumCount(final List<MusicFolder> musicFolders) { public int getAlbumCount(final List<MusicFolder> musicFolders) {

Loading…
Cancel
Save