sqlStr.append(" DISTINCT ");
}
/* 生成返回列的串 */
if (columns != null && columns.length != 0) {
SQL columnSQL = constructSelectedColumn(columns);
sqlStr.append(columnSQL.getSQLStatement());
values = columnSQL.getValueBuffered();
}else{
sqlStr.append("*");
}
/* 生成FROM子串, 如果tableName为空,将不构建FROM子句 */
if (tableName != null && tableName.length() != 0) {
sqlStr.append(" FROM ").append(tableName);
}
/* 生成查询条件串 */
if (condition != null && condition.size() != 0) {
sqlStr.append(" WHERE ").append(condition.getConditionStatement());
ObjectBuffered objBuff = condition.getValueBuffered();
if(values!=null){
values.append(objBuff);
}else{
values = objBuff;
}
}
/* 生成GROUP BY串 */
if (groupby != null && groupby.length() != 0) {
sqlStr.append(" GROUP BY ").append(groupby);
}
/* 生成ORDER BY串 */
if (orderby != null && orderby.length() != 0) {
sqlStr.append(" ORDER BY ").append(orderby);
}
return new SQL(SQL.SELECT, sqlStr, values, startIndex, rowLen);
}