|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Query
Any query
Method Summary | |
---|---|
Query |
bind(int index,
Object value)
Bind a new value to an indexed parameter |
Query |
bind(String param,
Object value)
Bind a new value to a named parameter |
int |
execute()
Execute the query, if it has been created with a properly configured factory |
List<Object> |
getBindValues()
Retrieve the bind values that will be bound by this Query. |
Param<?> |
getParam(String name)
Get a named parameter from the Query , provided its name. |
Map<String,Param<?>> |
getParams()
Get a Map of named parameters. |
String |
getSQL()
Retrieve the SQL code rendered by this Query This method can be expected to work correctly for any SQL dialect, as a query is usually "attached" when created from a Factory . |
String |
getSQL(boolean inline)
Retrieve the SQL code rendered by this Query See getSQL() for more details |
Methods inherited from interface org.jooq.Attachable |
---|
attach |
Methods inherited from interface org.jooq.Adapter |
---|
internalAPI |
Method Detail |
---|
int execute() throws DataAccessException
Query
:
DataAccessException
- If anything goes wrong in the databaseString getSQL()
This method can be expected to work correctly for any SQL dialect, as a
query is usually "attached" when created from a Factory
.
Use this method, when you want to use jOOQ for object oriented query creation, but execute the query with some other technology, such as
Note, this is the same as calling getSQL(boolean)
. The boolean
parameter will depend on your Factory
's Settings
:
StatementType |
boolean parameter | effect |
---|---|---|
StatementType.PREPARED_STATEMENT |
false (default) |
This will render bind variables to be used with a JDBC
PreparedStatement . You can extract bind values from this
Query using getBindValues() |
StatementType.STATIC_STATEMENT |
true |
This will inline all bind variables in a statement to be used with a
JDBC Statement |
getSQL(boolean)
String getSQL(boolean inline)
See getSQL()
for more details
inline
- Whether to inline bind variables. This overrides values in
Settings.getStatementType()
List<Object> getBindValues()
List
cannot be modified. To modify bind values, use
getParams()
instead.
Map<String,Param<?>> getParams()
Map
of named parameters. The Map
itself
cannot be modified, but the Param
elements allow for modifying
bind values on an existing Query
.
Bind values created with Factory.val(Object)
will have their bind
index as name.
Param
,
Factory.param(String, Object)
Param<?> getParam(String name)
Query
, provided its name.
Bind values created with Factory.val(Object)
will have their bind
index as name.
Param
,
Factory.param(String, Object)
Query bind(String param, Object value) throws IllegalArgumentException, DataTypeException
param
- The named parameter name. If this is a number, then this is
the same as calling bind(int, Object)
value
- The new bind value.
IllegalArgumentException
- if there is no parameter by the given
parameter name or index.
DataTypeException
- if value
cannot be converted into
the parameter's data typeQuery bind(int index, Object value) throws IllegalArgumentException, DataTypeException
index
- The parameter index, starting with 1value
- The new bind value.
IllegalArgumentException
- if there is no parameter by the given
parameter index.
DataTypeException
- if value
cannot be converted into
the parameter's data type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |