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 voidaccept(ValueTableVisitor visitor)Accept a visitor.voidadd(boolean... values)Add boolean values to the last row of the value table.voidadd(char... values)Add character values to the last row of the value table.voidadd(double... values)Add double values to the last row of the value table.voidadd(float... values)Add float values to the last row of the value table.voidadd(int... values)Add integer values to the last row of the value table.voidadd(long... values)Add long values to the last row of the value table.voidadd(ValueExpression... expressions)Add a list of value expressions to the last row of the value table.voidadd(String... values)Add string values to the last row of the value table.voidaddPlaceholder()Add an unnamed placeholder to the value table.voidalias(String tableNameAlias, String... columnNameAliases)Set alias for the value table.ValueTableappendRow(ValueTableRow row)Append aValueTableRowto theValueTable.ValueTableappendRow(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.StringgetTableNameAlias()Get a table name alias.booleanhasAlias()CHeck if the value table has an alias.protected booleanisEmpty()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:
thisfor fluent programming
-
appendRow
public ValueTable appendRow(ValueTableRow row)
Append aValueTableRowto theValueTable.- Parameters:
row- row to be appended- Returns:
thisfor 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:
trueif 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
-
-