com.datastax.driver.core.querybuilder
Class Select.SelectionOrAlias

java.lang.Object
  extended by com.datastax.driver.core.querybuilder.Select.Builder
      extended by com.datastax.driver.core.querybuilder.Select.Selection
          extended by com.datastax.driver.core.querybuilder.Select.SelectionOrAlias
Enclosing class:
Select

public static class Select.SelectionOrAlias
extends Select.Selection

An Selection clause for an in-construction SELECT statement.

This only differs from Select.Selection in that you can add an alias for the previously selected item through as(java.lang.String).


Method Summary
 Select.Builder all()
          Selects all columns (i.e.
 Select.Selection as(String alias)
          Adds an alias for the just selected item.
 Select.SelectionOrAlias column(String name)
          Selects the provided column.
 Select.Builder countAll()
          Selects the count of all returned rows (i.e.
 Select.SelectionOrAlias fcall(String name, Object... parameters)
          Creates a function call.
 Select from(String keyspace, String table)
          Adds the table to select from.
 Select from(TableMetadata table)
          Adds the table to select from.
 Select.SelectionOrAlias ttl(String name)
          Selects the ttl of provided column.
 Select.SelectionOrAlias writeTime(String name)
          Selects the write time of provided column.
 
Methods inherited from class com.datastax.driver.core.querybuilder.Select.Selection
distinct
 
Methods inherited from class com.datastax.driver.core.querybuilder.Select.Builder
from
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

all

public Select.Builder all()
Selects all columns (i.e. "SELECT * ...")

Specified by:
all in class Select.Selection
Returns:
an in-build SELECT statement.
Throws:
IllegalStateException - if some columns had already been selected for this builder.

countAll

public Select.Builder countAll()
Selects the count of all returned rows (i.e. "SELECT count(*) ...").

Specified by:
countAll in class Select.Selection
Returns:
an in-build SELECT statement.
Throws:
IllegalStateException - if some columns had already been selected for this builder.

column

public Select.SelectionOrAlias column(String name)
Selects the provided column.

Specified by:
column in class Select.Selection
Parameters:
name - the new column name to add.
Returns:
this in-build SELECT statement

writeTime

public Select.SelectionOrAlias writeTime(String name)
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)
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)
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

from

public Select from(String keyspace,
                   String table)
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)
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.


Copyright © 2013. All rights reserved.