Package com.exasol.sql
Class ValueTable
- java.lang.Object
-
- com.exasol.sql.AbstractFragment
-
- com.exasol.sql.ValueTable
-
- All Implemented Interfaces:
Fragment
public class ValueTable extends AbstractFragment
Value tables are pseudo-tables constructed from rows and columns of expressions (e.g. literals).
-
-
Field Summary
-
Fields inherited from class com.exasol.sql.AbstractFragment
root
-
-
Constructor Summary
Constructors Constructor Description ValueTable(Fragment root)
Create a newValueTable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ValueTableVisitor visitor)
Accept a visitor.void
add(boolean... values)
Add boolean values to the last row of the value table.void
add(char... values)
Add character values to the last row of the value table.void
add(double... values)
Add double values to the last row of the value table.void
add(float... values)
Add float values to the last row of the value table.void
add(int... values)
Add integer values to the last row of the value table.void
add(long... values)
Add long values to the last row of the value table.void
add(ValueExpression... expressions)
Add a list of value expressions to the last row of the value table.void
add(String... values)
Add string values to the last row of the value table.void
addPlaceholder()
Add an unnamed placeholder to the value table.void
alias(String tableNameAlias, String... columnNameAliases)
Set alias for the value table.ValueTable
appendRow(ValueTableRow row)
Append aValueTableRow
to theValueTable
.ValueTable
appendRow(String... literals)
Append a value table row consisting of value literals to the value table.List<String>
getColumnNameAliases()
Get column name aliases.List<ValueTableRow>
getRows()
Get a list of all rows in the value table.String
getTableNameAlias()
Get a table name alias.boolean
hasAlias()
CHeck if the value table has an alias.protected boolean
isEmpty()
Check if the value table is empty.-
Methods inherited from class com.exasol.sql.AbstractFragment
getRoot
-
-
-
-
Constructor Detail
-
ValueTable
public ValueTable(Fragment root)
Create a newValueTable
.- Parameters:
root
- SQL statement this table belongs to
-
-
Method Detail
-
appendRow
public ValueTable appendRow(String... literals)
Append a value table row consisting of value literals to the value table.- Parameters:
literals
- literals to be appended- Returns:
this
for fluent programming
-
appendRow
public ValueTable appendRow(ValueTableRow row)
Append aValueTableRow
to theValueTable
.- Parameters:
row
- row to be appended- Returns:
this
for fluent programming
-
getRows
public List<ValueTableRow> getRows()
Get a list of all rows in the value table.- Returns:
- rows
-
add
public void add(String... values)
Add string values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(char... values)
Add character values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(int... values)
Add integer values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(long... values)
Add long values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(double... values)
Add double values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(float... values)
Add float values to the last row of the value table.- Parameters:
values
- values to be added
-
add
public void add(boolean... values)
Add boolean values to the last row of the value table.- Parameters:
values
- values to be added
-
addPlaceholder
public void addPlaceholder()
Add an unnamed placeholder to the value table.Unnamed placeholders are the "?" in a prepared statement which are replaced by the actual variable values.
-
add
public void add(ValueExpression... expressions)
Add a list of value expressions to the last row of the value table.- Parameters:
expressions
- value expressions to be added
-
isEmpty
protected boolean isEmpty()
Check if the value table is empty.- Returns:
true
if the table is empty
-
accept
public void accept(ValueTableVisitor visitor)
Accept a visitor.- Parameters:
visitor
- to be accepted
-
alias
public void alias(String tableNameAlias, String... columnNameAliases)
Set alias for the value table.- Parameters:
tableNameAlias
- table name aliascolumnNameAliases
- zero or more column names aliases
-
hasAlias
public boolean hasAlias()
CHeck if the value table has an alias.- Returns:
- true if the value table has an alias
-
getTableNameAlias
public String getTableNameAlias()
Get a table name alias.- Returns:
- table name alias
-
-