code: public static String getCountSQL(String query) {
  		if (query == null) {
  			return null;
  		}
  		query = query.trim();
  		if (StringUtils.startsWithIgnoreCase(query, "select")) {
  			StringBuffer pagingSelect = new StringBuffer(query.length() + 30);
  			pagingSelect.append("select count(*) from ( ");
  			pagingSelect.append(query);
  			pagingSelect.append(" ) t");
  			return pagingSelect.toString();
  		}
  		return null;
  	}
docs: 获得查询SQL中可返回的结果数量的SQL语句
  
  @param query 原SQL语句
  
  @return SQL可返回的结果数量SQL语句