public class SQLExec extends IndirectQuery
SQLExec
can be used to select data (see execute(ObjectContext)
), it is normally used for updates, DDL operations, etc.Modifier and Type | Field and Description |
---|---|
protected String |
dataMapName |
protected Map<String,Object> |
params |
protected List<Object> |
positionalParams |
protected StringBuilder |
sqlBuffer |
dataMap, lastResolver, name, replacementQuery
Modifier and Type | Method and Description |
---|---|
SQLExec |
append(String sqlChunk)
Appends a piece of SQL to the previously stored SQL template.
|
protected Query |
createReplacementQuery(EntityResolver resolver)
Creates a substitute query.
|
QueryResult |
execute(ObjectContext context) |
Map<String,Object> |
getParams()
Returns a potentially immutable map of named parameters that will be
bound to SQL.
|
List<Object> |
getPositionalParams()
Returns a potentially immutable list of positional parameters that will
be bound to SQL.
|
String |
getSql() |
SQLExec |
params(Map<String,?> parameters) |
SQLExec |
params(String name,
Object value) |
SQLExec |
paramsArray(Object... params)
Initializes positional parameters of the query.
|
SQLExec |
paramsList(List<Object> params)
Initializes positional parameters of the query.
|
static SQLExec |
query(String sql)
Creates a query executing provided SQL run against default database.
|
static SQLExec |
query(String dataMapName,
String sql)
Creates a query executing provided SQL that performs routing based on the
provided DataMap name.
|
int |
update(ObjectContext context) |
int[] |
updateBatch(ObjectContext context) |
createSQLAction, getDataMap, getMetaData, getName, getReplacementQuery, route, setDataMap, setName
protected String dataMapName
protected StringBuilder sqlBuffer
public SQLExec(String sql)
public static SQLExec query(String sql)
public static SQLExec query(String dataMapName, String sql)
public String getSql()
public SQLExec append(String sqlChunk)
public SQLExec paramsArray(Object... params)
Note that calling this method will reset any previously set *named* parameters.
public SQLExec paramsList(List<Object> params)
Note that calling this method will reset any previously set *named* parameters.
public Map<String,Object> getParams()
public List<Object> getPositionalParams()
public QueryResult execute(ObjectContext context)
public int update(ObjectContext context)
public int[] updateBatch(ObjectContext context)
protected Query createReplacementQuery(EntityResolver resolver)
IndirectQuery
createReplacementQuery
in class IndirectQuery
Copyright © 2001–2023 Apache Cayenne. All rights reserved.