|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.silverpeas.jdbc.JdbcSqlQuery
public class JdbcSqlQuery
This class permits to build easily a SQL query with parameters. It permits also to execute directly the query.
Nested Class Summary | |
---|---|
static class |
JdbcSqlQuery.Configuration
Context of execution that has to be taken into account. |
Method Summary | ||
---|---|---|
JdbcSqlQuery |
addField(String fieldName,
String definition)
Centralization in order to populate the prepare statement parameters (FOR TABLE CREATION ONLY). |
|
JdbcSqlQuery |
addInsertParam(String paramName,
Object paramValue)
Centralization in order to populate the prepare statement parameters for insertion. |
|
JdbcSqlQuery |
addSaveParam(String paramName,
Object paramValue,
boolean isInsert)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
addSqlPart(String sqlPart,
Collection<?> paramValues)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
addSqlPart(String sqlPart,
Object... paramValue)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
addUpdateParam(String paramName,
Object paramValue)
Centralization in order to populate the prepare statement parameters for update. |
|
JdbcSqlQuery |
and(String sqlPart,
Collection<?> paramValues)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
and(String sqlPart,
Object... paramValue)
Centralization in order to populate the prepare statement parameters. |
|
static JdbcSqlQuery |
create(String sqlPart,
Collection<?> paramValue)
Creates a new instance of the SQL builder initialized with the given sql part. |
|
static JdbcSqlQuery |
create(String sqlPart,
Object... paramValue)
Creates a new instance of the SQL builder initialized with the given sql part. |
|
static JdbcSqlQuery |
createCountFor(String tableName)
Creates a new instance of the SQL builder initialized for count. |
|
static JdbcSqlQuery |
createDeleteFor(String tableName)
Creates a new instance of the SQL builder initialized for delete. |
|
static JdbcSqlQuery |
createDropFor(String tableName)
Creates a new instance of the SQL builder initialized for delete. |
|
static JdbcSqlQuery |
createInsertFor(String tableName)
Creates a new instance of the SQL builder initialized for insert. |
|
static JdbcSqlQuery |
createSelect(String sqlPart,
Collection<?> paramValue)
Creates a new instance of the SQL builder initialized with the given sql part. |
|
static JdbcSqlQuery |
createSelect(String sqlPart,
Object... paramValue)
Creates a new instance of the SQL builder initialized with the given sql part. |
|
static JdbcSqlQuery |
createTable(String tableName)
Creates a new instance of the SQL builder initialized for table creation. |
|
static JdbcSqlQuery |
createUpdateFor(String tableName)
Creates a new instance of the SQL builder initialized for update. |
|
long |
execute()
Modify executor. |
|
|
execute(SelectResultRowProcess<ROW_ENTITY> process)
Select executor. |
|
|
executeUnique(SelectResultRowProcess<ROW_ENTITY> process)
Select executor. |
|
Collection<?> |
getParameters()
Gets the parameters to apply to the SQL query. |
|
String |
getSqlQuery()
Gets the built SQL query. |
|
JdbcSqlQuery |
in(Collection<?> parameters)
Centralization in order to build easily a SQL in clause. |
|
JdbcSqlQuery |
in(Object... parameters)
Centralization in order to build easily a SQL in clause. |
|
static boolean |
isSqlDefined(String sqlValue)
Indicates if the specified value is defined in point of view of SQL. |
|
JdbcSqlQuery |
or(String sqlPart,
Collection<?> paramValues)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
or(String sqlPart,
Object... paramValue)
Centralization in order to populate the prepare statement parameters. |
|
static
|
unique(List<ENTITY> entities)
Gets from a entity list the unique entity expected. |
|
JdbcSqlQuery |
where(String sqlPart,
Collection<?> paramValues)
Centralization in order to populate the prepare statement parameters. |
|
JdbcSqlQuery |
where(String sqlPart,
Object... paramValue)
Centralization in order to populate the prepare statement parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isSqlDefined(String sqlValue)
sqlValue
- the value to verify.
public static <ENTITY> ENTITY unique(List<ENTITY> entities)
entities
- the entity list.
IllegalArgumentException
- if it exists more than one entity in the specified
list.public static JdbcSqlQuery create(String sqlPart, Object... paramValue)
sqlPart
- the sql part to append.paramValue
- the value of parameters included into the given sqlPart.
public static JdbcSqlQuery create(String sqlPart, Collection<?> paramValue)
sqlPart
- the sql part to append.paramValue
- the value of parameters included into the given sqlPart.
public static JdbcSqlQuery createSelect(String sqlPart, Object... paramValue)
sqlPart
- the sql part to append.paramValue
- the value of parameters included into the given sqlPart.
public static JdbcSqlQuery createSelect(String sqlPart, Collection<?> paramValue)
sqlPart
- the sql part to append.paramValue
- the value of parameters included into the given sqlPart.
public static JdbcSqlQuery createCountFor(String tableName)
tableName
- the table name aimed by the count.
public static JdbcSqlQuery createTable(String tableName)
tableName
- the table name aimed by the insert.
public static JdbcSqlQuery createInsertFor(String tableName)
tableName
- the table name aimed by the insert.
public static JdbcSqlQuery createUpdateFor(String tableName)
tableName
- the table name aimed by the update.
public static JdbcSqlQuery createDeleteFor(String tableName)
tableName
- the table name aimed by the delete.
public static JdbcSqlQuery createDropFor(String tableName)
tableName
- the table name aimed by the drop.
public String getSqlQuery()
public Collection<?> getParameters()
public JdbcSqlQuery addField(String fieldName, String definition)
fieldName
- the name of the field to define.definition
- the definition of the field.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery where(String sqlPart, Object... paramValue)
sqlPart
- the SQL part that contains the parameter.paramValue
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery where(String sqlPart, Collection<?> paramValues)
sqlPart
- the SQL part that contains the parameter.paramValues
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery and(String sqlPart, Object... paramValue)
sqlPart
- the SQL part that contains the parameter.paramValue
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery and(String sqlPart, Collection<?> paramValues)
sqlPart
- the SQL part that contains the parameter.paramValues
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery or(String sqlPart, Object... paramValue)
sqlPart
- the SQL part that contains the parameter.paramValue
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery or(String sqlPart, Collection<?> paramValues)
sqlPart
- the SQL part that contains the parameter.paramValues
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery addSqlPart(String sqlPart, Object... paramValue)
sqlPart
- the SQL part that contains the parameter.paramValue
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery addSqlPart(String sqlPart, Collection<?> paramValues)
sqlPart
- the SQL part that contains the parameter.paramValues
- the value of parameters included into the given sqlPart.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery in(Collection<?> parameters)
parameters
- the parameters to append to the given SQL query.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery in(Object... parameters)
parameters
- the parameters to append to the given SQL query.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery addInsertParam(String paramName, Object paramValue)
paramName
- the name of the parameter to add into update fields part.paramValue
- the value of the parameter.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery addUpdateParam(String paramName, Object paramValue)
paramName
- the name of the parameter to add into update fields part.paramValue
- the value of the parameter.
JdbcSqlQuery
that represents the SQL query.public JdbcSqlQuery addSaveParam(String paramName, Object paramValue, boolean isInsert)
paramName
- the name of the parameter to add into update fields part.paramValue
- the value of the parameter.isInsert
- indicates if the SQL built is an INSERT or an UPDATE one.
JdbcSqlQuery
that represents the SQL query.public <ROW_ENTITY> List<ROW_ENTITY> execute(SelectResultRowProcess<ROW_ENTITY> process) throws SQLException
SQLException
public <ROW_ENTITY> ROW_ENTITY executeUnique(SelectResultRowProcess<ROW_ENTITY> process) throws SQLException
SQLException
public long execute() throws SQLException
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |