protected void sort(SimpleFeatureType featureType, SortBy[] sort, String prefix, StringBuilder sql) throws IOException {
        if ((sort != null) && (sort.length > 0)) {
            sql.append(" ORDER BY ");

            for (int i = 0; i < sort.length; i++) {
                String order;
                if (sort[i].getSortOrder() == SortOrder.DESCENDING) {
                    order = " DESC";
                } else {
                    order = " ASC";
                }
                
                sql.append(sort[i].getPropertyName());
                sql.append(order);
                sql.append(",");
            }

            sql.setLength(sql.length() - 1);
        }
    }