Package com.exasol.sql.dml.insert
Class AbstractInsertValueTable<T extends AbstractInsertValueTable<T>>
- java.lang.Object
-
- com.exasol.sql.AbstractFragment
-
- com.exasol.sql.dml.insert.AbstractInsertValueTable<T>
-
- Type Parameters:
T
- self pointer
- All Implemented Interfaces:
Fragment
- Direct Known Subclasses:
Insert
,MergeInsertClause
public abstract class AbstractInsertValueTable<T extends AbstractInsertValueTable<T>> extends AbstractFragment
Abstract base class for SQL fragments that contain a insert value table (for exampleINSERT
,MERGE
).
-
-
Field Summary
Fields Modifier and Type Field Description protected InsertFields
insertFields
Fields to insertprotected ValueTable
insertValueTable
Table with values used in theINSERT
statement-
Fields inherited from class com.exasol.sql.AbstractFragment
root
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractInsertValueTable(Fragment root)
Create the abstract base for a fragment containing a value table.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
createInsertValueInstanceIfItDoesNotExist()
Prepare the value table.T
field(String... names)
Define fields into which should be inserted.boolean
hasFields()
Check if a insert fields are defined.boolean
hasValues()
Check if a value table is present.protected abstract T
self()
Generic self pointer.T
valuePlaceholder()
Add an unnamed value placeholder to the value list (this is useful for prepared statements).T
valuePlaceholders(int amount)
Add a given number unnamed value placeholder to the value list (this is useful for prepared statements).T
values(int... values)
Insert a list of integer values.T
values(ValueExpression... expressions)
Insert a list of value expressions.T
values(String... values)
Insert a list of string values.T
valueTable(ValueTable table)
Insert a value table.-
Methods inherited from class com.exasol.sql.AbstractFragment
getRoot
-
-
-
-
Field Detail
-
insertValueTable
protected ValueTable insertValueTable
Table with values used in theINSERT
statement
-
insertFields
protected InsertFields insertFields
Fields to insert
-
-
Constructor Detail
-
AbstractInsertValueTable
protected AbstractInsertValueTable(Fragment root)
Create the abstract base for a fragment containing a value table.- Parameters:
root
- root fragment
-
-
Method Detail
-
self
protected abstract T self()
Generic self pointer.- Returns:
- self pointer.
-
createInsertValueInstanceIfItDoesNotExist
protected void createInsertValueInstanceIfItDoesNotExist()
Prepare the value table.
-
field
public T field(String... names)
Define fields into which should be inserted.- Parameters:
names
- field names- Returns:
this
for fluent programming
-
valueTable
public T valueTable(ValueTable table)
Insert a value table.- Parameters:
table
- value table to be inserted- Returns:
this
for fluent programming
-
values
public T values(String... values)
Insert a list of string values.- Parameters:
values
- string values to be inserted- Returns:
this
for fluent programming
-
values
public T values(int... values)
Insert a list of integer values.- Parameters:
values
- integer values to be inserted- Returns:
this
for fluent programming
-
values
public T values(ValueExpression... expressions)
Insert a list of value expressions.- Parameters:
expressions
- value expressions to be inserted- Returns:
this
for fluent programming
-
valuePlaceholder
public T valuePlaceholder()
Add an unnamed value placeholder to the value list (this is useful for prepared statements).- Returns:
this
for fluent programming
-
valuePlaceholders
public T valuePlaceholders(int amount)
Add a given number unnamed value placeholder to the value list (this is useful for prepared statements).- Parameters:
amount
- number of placeholders to be added- Returns:
this
for fluent programming
-
hasValues
public boolean hasValues()
Check if a value table is present.- Returns:
true
if a value table exists
-
hasFields
public boolean hasFields()
Check if a insert fields are defined.- Returns:
true
if insert fields are defined
-
-