Skip to content

Commit

Permalink
Remove group and having methods in ClusterQuery. The query function i…
Browse files Browse the repository at this point in the history
…n LitePal doesn't suit group by statement.
  • Loading branch information
sinyu890807 committed Jul 30, 2013
1 parent 2bdfa03 commit e67c6cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
17 changes: 1 addition & 16 deletions src/org/litepal/crud/ClusterQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ public class ClusterQuery {

String[] mConditions;

String mGroupBy;

String mHaving;

String mOrderBy;

String mLimit;
Expand All @@ -31,16 +27,6 @@ public ClusterQuery where(String... conditions) {
return this;
}

public ClusterQuery group(String args) {
mGroupBy = args;
return this;
}

public ClusterQuery having(String options) {
mHaving = options;
return this;
}

public ClusterQuery order(String args) {
mOrderBy = args;
return this;
Expand All @@ -53,8 +39,7 @@ public ClusterQuery limit(int value) {

public <T> List<T> execute(Class<T> modelClass) {
QueryHandler queryHandler = new QueryHandler(Connector.getDatabase());
return queryHandler.onFind(modelClass, mColumns, mConditions, mGroupBy, mHaving, mOrderBy,
mLimit);
return queryHandler.onFind(modelClass, mColumns, mConditions, mOrderBy, mLimit);
}

}
12 changes: 0 additions & 12 deletions src/org/litepal/crud/DataSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ public static ClusterQuery where(String... conditions) {
return cQuery;
}

public static ClusterQuery group(String args) {
ClusterQuery cQuery = new ClusterQuery();
cQuery.mGroupBy = args;
return cQuery;
}

public static ClusterQuery having(String options) {
ClusterQuery cQuery = new ClusterQuery();
cQuery.mHaving = options;
return cQuery;
}

public static ClusterQuery order(String args) {
ClusterQuery cQuery = new ClusterQuery();
cQuery.mOrderBy = args;
Expand Down
6 changes: 3 additions & 3 deletions src/org/litepal/crud/QueryHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ <T> List<T> onFindAll(Class<T> modelClass, long... ids) {
return dataList;
}

<T> List<T> onFind(Class<T> modelClass, String[] columns, String[] conditions, String groupBy,
String having, String orderBy, String limit) {
<T> List<T> onFind(Class<T> modelClass, String[] columns, String[] conditions, String orderBy,
String limit) {
checkConditionsCorrect(conditions);
List<T> dataList = query(modelClass, columns, getWhereClause(conditions),
getWhereArgs(conditions), groupBy, having, orderBy, limit);
getWhereArgs(conditions), null, null, orderBy, limit);
return dataList;
}

Expand Down

0 comments on commit e67c6cd

Please sign in to comment.