public class Query extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AnnotationProvider |
annotationProvider |
protected Class |
elementType |
protected Class |
mapper |
protected Map<String,Object> |
parameters |
protected String |
parsedSql |
protected Class |
returnType |
protected String[] |
roles |
protected SqlSession |
session |
protected String |
sql |
protected List<Object> |
sqlParameters |
| Constructor and Description |
|---|
Query(SqlSession session,
String sql,
Class mapper,
AnnotationProvider annotationProvider,
String[] roles,
Map<String,Object> parameters,
Class<?> returnClass,
Type returnType) |
Query(SqlSession session,
String sql,
Map<String,Object> parameters,
Class<?> returnClass) |
| Modifier and Type | Method and Description |
|---|---|
String |
addSqlParameter(Object value) |
Object |
evalField(Object o,
String path)
Extrait la valeur du champs pointé par path, si durant la navigation
dans le path une des composantes est null, alors null est retourné.
|
Object |
evalField(String path) |
Object |
evalFunction(Object value,
String name,
List args) |
boolean |
execute() |
<E> E |
executeQuery() |
<E> E |
executeUpdate() |
protected Optional<String> |
getFormattedRoles() |
String |
getParsedSql() |
SqlSession |
getSession() |
protected PreparedStatement |
getStatement(String sql) |
protected int |
indexOfDot(String name)
Finds the very first next dot.
|
protected String |
parseParameters(String sql) |
protected SqlSession session
protected String sql
protected Class mapper
protected AnnotationProvider annotationProvider
protected String[] roles
protected Class returnType
protected Class elementType
protected String parsedSql
public Query(SqlSession session, String sql, Class mapper, AnnotationProvider annotationProvider, String[] roles, Map<String,Object> parameters, Class<?> returnClass, Type returnType) throws Exception
session - session to usesql - sql request as stringmapper - mapper to use (default: json)annotationProvider - permit to retrieve annotation mapper configroles - Role authorized to execute this queryparameters - parameters of sql requestreturnClass - wanted returned typeExceptionpublic String getParsedSql() throws SQLException
SQLExceptionpublic Object evalField(Object o, String path)
o - l'objet de de departpath - le path (ex: "toto.titi.truc[2].bidulle")protected int indexOfDot(String name)
-1 when dot is not found.public String addSqlParameter(Object value)
value - object to used as parameter for sql querypublic SqlSession getSession()
protected PreparedStatement getStatement(String sql) throws SQLException
SQLExceptionpublic <E> E executeUpdate()
throws SQLException,
Exception
SQLExceptionExceptionpublic boolean execute()
throws SQLException
SQLExceptionCopyright © 2017–2019 CodeLutin. All rights reserved.