microsoft-azure-storage/src/com/microsoft/azure/storage/table/TableQuery.java
protected UriQueryBuilder generateQueryBuilder() throws StorageException {
        final UriQueryBuilder builder = new UriQueryBuilder();
        if (!Utility.isNullOrEmpty(this.filterString)) {
            builder.add(TableConstants.FILTER, this.filterString);
        }

        if (this.takeCount != null) {
            builder.add(TableConstants.TOP, this.takeCount.toString());
        }

        if (this.columns != null && this.columns.length > 0) {
            final StringBuilder colBuilder = new StringBuilder();

            boolean foundRk = false;
            boolean foundPk = false;
            boolean roundTs = false;

            for (int m = 0; m < this.columns.length; m++) {
                if (TableConstants.ROW_KEY.equals(this.columns[m])) {
                    foundRk = true;
                }
                else if (TableConstants.PARTITION_KEY.equals(this.columns[m])) {
                    foundPk = true;
                }
                else if (TableConstants.TIMESTAMP.equals(this.columns[m])) {
                    roundTs = true;
                }

                colBuilder.append(this.columns[m]);
                if (m < this.columns.length - 1) {
                    colBuilder.append(",");
                }
            }

            if (!foundPk) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.PARTITION_KEY);
            }

            if (!foundRk) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.ROW_KEY);
            }

            if (!roundTs) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.TIMESTAMP);
            }

            builder.add(TableConstants.SELECT, colBuilder.toString());
        }

        return builder;
    }
protected UriQueryBuilder generateQueryBuilder() throws StorageException {
        final UriQueryBuilder builder = new UriQueryBuilder();
        if (!Utility.isNullOrEmpty(this.filterString)) {
            builder.add(TableConstants.FILTER, this.filterString);
        }

        if (this.takeCount != null) {
            builder.add(TableConstants.TOP, this.takeCount.toString());
        }

        if (this.columns != null && this.columns.length > 0) {
            final StringBuilder colBuilder = new StringBuilder();

            boolean foundRk = false;
            boolean foundPk = false;
            boolean roundTs = false;

            for (int m = 0; m < this.columns.length; m++) {
                if (TableConstants.ROW_KEY.equals(this.columns[m])) {
                    foundRk = true;
                }
                else if (TableConstants.PARTITION_KEY.equals(this.columns[m])) {
                    foundPk = true;
                }
                else if (TableConstants.TIMESTAMP.equals(this.columns[m])) {
                    roundTs = true;
                }

                colBuilder.append(this.columns[m]);
                if (m < this.columns.length - 1) {
                    colBuilder.append(",");
                }
            }

            if (!foundPk) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.PARTITION_KEY);
            }

            if (!foundRk) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.ROW_KEY);
            }

            if (!roundTs) {
                colBuilder.append(",");
                colBuilder.append(TableConstants.TIMESTAMP);
            }

            builder.add(TableConstants.SELECT, colBuilder.toString());
        }

        return builder;
    }
Reserved for internal use. Creates a {@link UriQueryBuilder} object representing the table query.

@return A {@link UriQueryBuilder} object representing the table query.

@throws StorageException
if an error occurs in adding or encoding the query parameters.