Package com.github.eikecochu.sqlbuilder
Class Insert
- java.lang.Object
-
- com.github.eikecochu.sqlbuilder.QueryPartImpl<Insert>
-
- com.github.eikecochu.sqlbuilder.Insert
-
- All Implemented Interfaces:
BeforeSelect<Insert>,QueryBuilder<Insert>,QueryPart,QueryPartLinked<Insert>,QueryPartSQL<Insert>
public class Insert extends QueryPartImpl<Insert> implements QueryBuilder<Insert>, BeforeSelect<Insert>
The INSERT expression. Start with this expression to prepare an INSERT query to insert elements into the database.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInsert(BeforeInsert<?> parent, java.lang.String table)Insert(Table table)Create a new INSERT statementInsert(java.lang.String table)Create a new INSERT statement
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InsertValuecolumn(java.lang.String column)Use a column to insert values intoInsertcolumn(java.lang.String column, java.lang.Object value)Insert a value into a column by nameInsertcolumns(ValueHolder values)Insert multiple values by ValueHolderInsertdefaults()Resets this INSERT statement columns and valuesInsertorAbort()Set this INSERT statement to be INSERT OR ABORTInsertorFail()Set this INSERT statement to be INSERT OR FAILInsertorIgnore()Set this INSERT statement to be INSERT OR IGNOREInsertorReplace()Set this INSERT statement to be INSERT OR REPLACEInsertorRollback()Set this INSERT statement to be INSERT OR ROLLBACKInsertreplace()Set this INSERT statement to be REPLACESelectselect()Continue query with SELECTjava.lang.Stringstring(QueryOptions options)Transforms this statement into an SQL stringInsertvalue(java.lang.Object value)Insert a value by value only.Insertvalues(ValueHolder values)Insert multiple values by value only.-
Methods inherited from class com.github.eikecochu.sqlbuilder.QueryPartImpl
parent, sql
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeSelect
select, select, selectSQL
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryBuilder
query, query
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryPartLinked
ext, parent, parent
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryPartSQL
sql
-
-
-
-
Constructor Detail
-
Insert
public Insert(java.lang.String table)
Create a new INSERT statement- Parameters:
table- The name of the table to insert into
-
Insert
public Insert(Table table)
Create a new INSERT statement- Parameters:
table- The name of the table to insert into
-
Insert
protected Insert(BeforeInsert<?> parent, java.lang.String table)
-
-
Method Detail
-
replace
public Insert replace()
Set this INSERT statement to be REPLACE- Returns:
- This INSERT statement
-
orReplace
public Insert orReplace()
Set this INSERT statement to be INSERT OR REPLACE- Returns:
- This INSERT statement
-
orRollback
public Insert orRollback()
Set this INSERT statement to be INSERT OR ROLLBACK- Returns:
- This INSERT statement
-
orAbort
public Insert orAbort()
Set this INSERT statement to be INSERT OR ABORT- Returns:
- This INSERT statement
-
orFail
public Insert orFail()
Set this INSERT statement to be INSERT OR FAIL- Returns:
- This INSERT statement
-
orIgnore
public Insert orIgnore()
Set this INSERT statement to be INSERT OR IGNORE- Returns:
- This INSERT statement
-
select
public Select select()
Description copied from interface:BeforeSelectContinue query with SELECT- Specified by:
selectin interfaceBeforeSelect<Insert>- Returns:
- The new SELECT statement
-
column
public InsertValue column(java.lang.String column)
Use a column to insert values into- Parameters:
column- The name of the column- Returns:
- The InsertValue instance to set the value to be inserted
-
column
public Insert column(java.lang.String column, java.lang.Object value)
Insert a value into a column by name- Parameters:
column- The name of the columnvalue- The value to be inserted- Returns:
- This INSERT statement
-
columns
public Insert columns(ValueHolder values)
Insert multiple values by ValueHolder- Parameters:
values- The ValueHolder of the values to be inserted- Returns:
- This INSERT statement
-
value
public Insert value(java.lang.Object value)
Insert a value by value only. This will only work if no column names are specified.- Parameters:
value- The value to be inserted- Returns:
- This INSERT statement
-
values
public Insert values(ValueHolder values)
Insert multiple values by value only. This will only work if no column names are specified.- Parameters:
values- The values to be inserted- Returns:
- This INSERT statement
-
defaults
public Insert defaults()
Resets this INSERT statement columns and values- Returns:
- This INSERT statement
-
string
public java.lang.String string(QueryOptions options)
Description copied from interface:QueryPartTransforms this statement into an SQL string
-
-