Browse Source

Fix a bug and limit 1 select when select first

tags/v1.3.0
Kazunobu Raita 10 years ago
parent
commit
8fc1848028
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/main/java/com/iciql/Query.java

+ 3
- 2
src/main/java/com/iciql/Query.java View File

@@ -95,7 +95,8 @@ public class Query<T> {
}
public T selectFirst() {
return select(false).get(0);
List<T> list = limit(1).select(false);
return list.isEmpty() ? null : list.get(0);
}
public List<T> selectDistinct() {
@@ -104,7 +105,7 @@ public class Query<T> {
@SuppressWarnings("unchecked")
public <X, Z> X selectFirst(Z x) {
List<X> list = (List<X>) select(x);
List<X> list = limit(1).select(x);
return list.isEmpty() ? null : list.get(0);
}

Loading…
Cancel
Save