Class Select.SelectionOrAlias

    • Constructor Detail

      • SelectionOrAlias

        public SelectionOrAlias()
    • Method Detail

      • as

        public Select.Selection as​(String alias)
        Adds an alias for the just selected item.
        Parameters:
        alias - the name of the alias to use.
        Returns:
        this in-build SELECT statement
      • writeTime

        public Select.SelectionOrAlias writeTime​(String name)
        Description copied from class: Select.Selection
        Selects the write time of provided column.

        This is a shortcut for fcall("writetime", QueryBuilder.column(name)).

        Specified by:
        writeTime in class Select.Selection
        Parameters:
        name - the name of the column to select the write time of.
        Returns:
        this in-build SELECT statement
      • ttl

        public Select.SelectionOrAlias ttl​(String name)
        Description copied from class: Select.Selection
        Selects the ttl of provided column.

        This is a shortcut for fcall("ttl", QueryBuilder.column(name)).

        Specified by:
        ttl in class Select.Selection
        Parameters:
        name - the name of the column to select the ttl of.
        Returns:
        this in-build SELECT statement
      • fcall

        public Select.SelectionOrAlias fcall​(String name,
                                             Object... parameters)
        Description copied from class: Select.Selection
        Creates a function call.

        Please note that the parameters are interpreted as values, and so fcall("textToBlob", "foo") will generate the string "textToBlob('foo')". If you want to generate "textToBlob(foo)", i.e. if the argument must be interpreted as a column name (in a select clause), you will need to use the QueryBuilder.column(java.lang.String) method, and so fcall("textToBlob", QueryBuilder.column(foo).

        Specified by:
        fcall in class Select.Selection
        Parameters:
        name - the name of the function.
        parameters - the parameters for the function call.
        Returns:
        this in-build SELECT statement
      • raw

        public Select.SelectionOrAlias raw​(String rawString)
        Description copied from class: Select.Selection
        Selects the provided raw expression.

        The provided string will be appended to the query as-is, without any form of escaping or quoting.

        Overrides:
        raw in class Select.Selection
        Parameters:
        rawString - the raw expression to add.
        Returns:
        this in-build SELECT statement
      • path

        public Select.SelectionOrAlias path​(String... segments)
        Description copied from class: Select.Selection
        Selects the provided path.

        All given path segments will be concatenated together with dots. If any segment contains an identifier that needs quoting, caller code is expected to call QueryBuilder.quote(String) prior to invoking this method.

        This method is currently only useful when accessing individual fields of a user-defined type (UDT), which is only possible since CASSANDRA-7423.

        Note that currently nested UDT fields are not supported and will be rejected by the server as a syntax error.

        Overrides:
        path in class Select.Selection
        Parameters:
        segments - the segments of the path to create.
        Returns:
        this in-build SELECT statement
        See Also:
        CASSANDRA-7423
      • toJson

        public Select.SelectionOrAlias toJson​(String name)
        Description copied from class: Select.Selection
        Creates a toJson() function call. This is a shortcut for fcall("toJson", QueryBuilder.column(name)).

        Support for JSON functions has been added in Cassandra 2.2. The toJson() function is similar to SELECT JSON statements, but applies to a single column value instead of the entire row, and produces a JSON-encoded string representing the normal Cassandra column value.

        It may only be used in the selection clause of a SELECT statement.

        Overrides:
        toJson in class Select.Selection
        Parameters:
        name - the column to retrieve JSON from.
        Returns:
        the function call.
        See Also:
        JSON Support for CQL, JSON Support in Cassandra 2.2
      • from

        public Select from​(String keyspace,
                           String table)
        Description copied from class: Select.Builder
        Adds the table to select from.
        Overrides:
        from in class Select.Builder
        Parameters:
        keyspace - the name of the keyspace to select from.
        table - the name of the table to select from.
        Returns:
        a newly built SELECT statement that selects from keyspace.table.
      • from

        public Select from​(TableMetadata table)
        Description copied from class: Select.Builder
        Adds the table to select from.
        Overrides:
        from in class Select.Builder
        Parameters:
        table - the table to select from.
        Returns:
        a newly built SELECT statement that selects from table.
      • from

        public Select from​(MaterializedViewMetadata view)
        Description copied from class: Select.Builder
        Adds the materialized view to select from.
        Overrides:
        from in class Select.Builder
        Parameters:
        view - the materialized view to select from.
        Returns:
        a newly built SELECT statement that selects from view.