public class InsertQuery extends BaseCTEQuery<ThisType>
Modifier and Type | Field and Description |
---|---|
protected SqlObjectList<SqlObject> |
_columns |
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
InsertQuery(Object tableStr) |
InsertQuery(Table table) |
Modifier and Type | Method and Description |
---|---|
InsertQuery |
addColumn(Column column,
Object value)
Adds the given column and its corresponding value to the query.
|
InsertQuery |
addColumns(Column[] columns,
Object[] values)
Adds the given columns and their corresponding values to the query.
|
InsertQuery |
addCustomColumn(Object columnStr,
Object value)
Adds the given column and its corresponding value to the query.
|
InsertQuery |
addCustomColumns(Object[] columnStrs,
Object[] values)
Adds the given columns and their corresponding values to the query.
|
InsertQuery |
addCustomPreparedColumns(Object... columnStrs)
Adds the given columns and an equal number of QUESTION_MARK values to
the query.
|
InsertQuery |
addPreparedColumnCollection(Collection<? extends Column> columns)
Adds the given columns and an equal number of QUESTION_MARK values to
the query.
|
InsertQuery |
addPreparedColumns(Column... columns)
Adds the given columns and an equal number of QUESTION_MARK values to
the query.
|
protected void |
appendPrefixTo(AppendableExt app)
Appends the prefix "INSERT INTO (<columns>)" to the given
AppendableExt.
|
protected void |
appendTo(AppendableExt app,
SqlContext newContext)
Appends the sql query to the given AppendableExt within the given,
modifiable SqlContext.
|
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
void |
validate(ValidationContext vContext)
Does Query.validate() and additionally verifies that there are an equal
number of columns and values.
|
addCommonTableExpression, prependTo, setRecursive
appendTo, getThisType, validate, validateTables
addCustomization, customAppendTo, customAppendTo, maybeAppendTo, maybeAppendTo
collectSchemaObjects, doValidate, toString
toString, toString
protected SqlObjectList<SqlObject> _columns
public InsertQuery(Table table)
table
- table into which to insert the values.public InsertQuery(Object tableStr)
tableStr
- name of the table into which to insert the values.
Object
-> SqlObject
conversions handled by
Converter.toCustomTableSqlObject(Object)
.public InsertQuery addCustomColumn(Object columnStr, Object value)
columnStr
- Object
-> SqlObject
conversions
handled by Converter.CUSTOM_COLUMN_TO_OBJ
.value
- Object
-> SqlObject
conversions
handled by Converter.VALUE_TO_OBJ
.public InsertQuery addCustomColumns(Object[] columnStrs, Object[] values)
columnStrs
- Object
-> SqlObject
conversions
handled by Converter.CUSTOM_COLUMN_TO_OBJ
.values
- Object
-> SqlObject
conversions
handled by Converter.VALUE_TO_OBJ
.public InsertQuery addColumn(Column column, Object value)
public InsertQuery addColumns(Column[] columns, Object[] values)
public InsertQuery addCustomPreparedColumns(Object... columnStrs)
Object
-> SqlObject
conversions handled by
Converter.CUSTOM_COLUMN_TO_OBJ
.
public InsertQuery addPreparedColumns(Column... columns)
public InsertQuery addPreparedColumnCollection(Collection<? extends Column> columns)
public void validate(ValidationContext vContext) throws ValidationException
validate
in interface Verifiable<InsertQuery>
validate
in class Query<InsertQuery>
vContext
- handle to the current, filled-in validation contextValidationException
protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
vContext
- handle to the current validation contextprotected void appendTo(AppendableExt app, SqlContext newContext) throws IOException
Query
Query.appendTo(AppendableExt)
method within the context of calls to
SqlContext.pushContext(com.healthmarketscience.common.util.AppendableExt)
and SqlContext.popContext(com.healthmarketscience.common.util.AppendableExt, com.healthmarketscience.sqlbuilder.SqlContext)
, so
the implementation is free to modify the given SqlContext.appendTo
in class Query<InsertQuery>
app
- the target for the sql query generationnewContext
- modifiable SqlContext for nested AppendeesIOException
protected void appendPrefixTo(AppendableExt app) throws IOException
IOException
Copyright © 2006–2021 OpenHMS. All rights reserved.