Package com.gengoai.sql.statement
Class UpsertClause
- java.lang.Object
-
- com.gengoai.sql.statement.UpsertClause
-
- All Implemented Interfaces:
SQLElement
,Serializable
public class UpsertClause extends Object implements SQLElement
Defines an upsert clause when there is a key conflict on an
Insert
statement- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UpsertClause()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UpsertClause
action(@NonNull UpsertAction action)
The action to perform on upsertUpsertClause
doNothing()
Do nothing on upsertUpsertClause
doUpdateSet()
Perform an update on upsertUpsertClause
indexedColumns(@NonNull SQLElement... columns)
Sets the columns that specifies the keys (indexed columns) for the upsertUpsertClause
indexedColumns(@NonNull String... columns)
Sets the columns that specifies the keys (indexed columns) for the upsertUpsertClause
indexedColumns(@NonNull Collection<? extends SQLElement> columns)
Sets the columns that specifies the keys (indexed columns) for the upsertUpsertClause
indexedParameters()
Indexed parameters upsert clause.UpsertClause
indexedWhere(SQLElement whereClause)
Sets the criteria (i.e.UpsertClause
indexedWhere(String whereClause)
Sets the criteria (i.e.UpsertClause
set(@NonNull SQLElement column, @NonNull SQLElement value)
Adds a set parameter to the update defined as a column and value.UpsertClause
set(@NonNull String column, @NonNull SQLElement value)
Adds a set parameter to the update defined as a column and value.UpsertClause
setIndexedParameter(@NonNull SQLElement column)
Adds a set parameter for the given column and using an indexed parameter value for use inPreparedStatement
UpsertClause
setNamedParameter(@NonNull SQLElement column)
Adds a set parameter for the given column and using a named parameter value for use inNamedPreparedStatement
UpsertClause
updateWhere(SQLElement whereClause)
Sets the criteria (i.e.UpsertClause
updateWhere(String whereClause)
Sets the criteria (i.e.static UpsertClause
upsert()
Creates a new Upsert clausestatic UpsertClause
upsert(@NonNull SQLElement... columns)
Creates a new Upsert clause with given columns as the keys (indexed columns)static UpsertClause
upsert(@NonNull String... columns)
Creates a new Upsert clause with given columns as the keys (indexed columns)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.gengoai.sql.SQLElement
getClassName
-
-
-
-
Method Detail
-
upsert
public static UpsertClause upsert()
Creates a new Upsert clause- Returns:
- the upsert clause
-
upsert
public static UpsertClause upsert(@NonNull @NonNull String... columns)
Creates a new Upsert clause with given columns as the keys (indexed columns)- Parameters:
columns
- the key (index) columns- Returns:
- this upsert clause
-
upsert
public static UpsertClause upsert(@NonNull @NonNull SQLElement... columns)
Creates a new Upsert clause with given columns as the keys (indexed columns)- Parameters:
columns
- the key (index) columns- Returns:
- this upsert clause
-
action
public UpsertClause action(@NonNull @NonNull UpsertAction action)
The action to perform on upsert- Parameters:
action
- the action to perform on upsert- Returns:
- this upsert clause
-
doNothing
public UpsertClause doNothing()
Do nothing on upsert- Returns:
- this upsert clause
-
doUpdateSet
public UpsertClause doUpdateSet()
Perform an update on upsert- Returns:
- this upsert clause
-
indexedColumns
public UpsertClause indexedColumns(@NonNull @NonNull String... columns)
Sets the columns that specifies the keys (indexed columns) for the upsert- Parameters:
columns
- the key (index) columns- Returns:
- this upsert clause
-
indexedColumns
public UpsertClause indexedColumns(@NonNull @NonNull SQLElement... columns)
Sets the columns that specifies the keys (indexed columns) for the upsert- Parameters:
columns
- the key (index) columns- Returns:
- this upsert clause
-
indexedColumns
public UpsertClause indexedColumns(@NonNull @NonNull Collection<? extends SQLElement> columns)
Sets the columns that specifies the keys (indexed columns) for the upsert- Parameters:
columns
- the key (index) columns- Returns:
- this upsert clause
-
indexedParameters
public UpsertClause indexedParameters()
Indexed parameters upsert clause.- Returns:
- this upsert clause
-
indexedWhere
public UpsertClause indexedWhere(String whereClause)
Sets the criteria (i.e. WHERE) for the UpsertClause.- Parameters:
whereClause
- the where clause- Returns:
- this UpsertClause object
-
indexedWhere
public UpsertClause indexedWhere(SQLElement whereClause)
Sets the criteria (i.e. WHERE) for the UpsertClause.- Parameters:
whereClause
- the where clause- Returns:
- this UpsertClause object
-
set
public UpsertClause set(@NonNull @NonNull SQLElement column, @NonNull @NonNull SQLElement value)
Adds a set parameter to the update defined as a column and value.- Parameters:
column
- the column to updatevalue
- the value to update the column to- Returns:
- this UpsertClause statement
-
set
public UpsertClause set(@NonNull @NonNull String column, @NonNull @NonNull SQLElement value)
Adds a set parameter to the update defined as a column and value.- Parameters:
column
- the column to updatevalue
- the value to update the column to- Returns:
- this UpsertClause statement
-
setIndexedParameter
public UpsertClause setIndexedParameter(@NonNull @NonNull SQLElement column)
Adds a set parameter for the given column and using an indexed parameter value for use inPreparedStatement
- Parameters:
column
- the column to update- Returns:
- this UpsertClause statement
-
setNamedParameter
public UpsertClause setNamedParameter(@NonNull @NonNull SQLElement column)
Adds a set parameter for the given column and using a named parameter value for use inNamedPreparedStatement
- Parameters:
column
- the column to update- Returns:
- this UpsertClause statement
-
updateWhere
public UpsertClause updateWhere(String whereClause)
Sets the criteria (i.e. WHERE) for the UpsertClause.- Parameters:
whereClause
- the where clause- Returns:
- this UpsertClause object
-
updateWhere
public UpsertClause updateWhere(SQLElement whereClause)
Sets the criteria (i.e. WHERE) for the UpsertClause.- Parameters:
whereClause
- the where clause- Returns:
- this UpsertClause object
-
-