public class SqlCondition extends Condition implements java.lang.Cloneable
Condition| Constructor and Description |
|---|
SqlCondition()
Default Constructor
|
SqlCondition(java.lang.String orderBy)
Constructor for SqlCondition
|
SqlCondition(java.lang.String field,
java.lang.Object value)
Constructor for SqlCondition
|
SqlCondition(java.lang.String field,
java.lang.Object value,
java.lang.String orderBy)
Constructor for SqlCondition
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCondition(java.lang.String field,
java.lang.Object value)
Implementation of addCondition which checks for
null values
and makes them absolute so the condition will have a condition FIELD IS NULL
in the query. |
void |
addOrderBy(java.lang.String field,
boolean descending)
adds an Order By statement with the option to sort it
descending
|
void |
addParameter(int idx,
int i)
adds a integer value for the given placeholder position in the
prepared statement.
|
void |
addParameter(int idx,
java.lang.Object o)
adds a value for the given placeholder position in the
prepared statement.
|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object o) |
int |
getLastParameter() |
java.util.ArrayList |
getParameters()
get a List of the parameter values which were added.
|
java.lang.String |
getPreparedQuery()
get the SQL WHERE clause
|
java.sql.PreparedStatement |
getPreparedStatement(java.sql.Connection con,
java.lang.String select)
returns a prepared statement build from
the prepared query set, the parameters added,
the conditions set and the order by supplied.
|
java.sql.PreparedStatement |
getScrollabeStatement(java.sql.Connection con,
java.lang.String select) |
int |
hashCode() |
void |
setPreparedQuery(java.lang.String preparedQuery)
set the SQL WHERE clause for this condition.
|
void |
setRecordLimit(int records) |
addCondition, addCondition, addOrderBy, clearOrderBy, getConditions, getFilter, getFilterByKey, getOrderBy, removeCondition, removeFilter, setFilterpublic SqlCondition()
public SqlCondition(java.lang.String orderBy)
public SqlCondition(java.lang.String field,
java.lang.Object value)
public SqlCondition(java.lang.String field,
java.lang.Object value,
java.lang.String orderBy)
public java.sql.PreparedStatement getPreparedStatement(java.sql.Connection con,
java.lang.String select)
throws java.sql.SQLException
If a prepared query has placeholders, the addParameters must be called for every placeholder supplied.
con - Connection, the connection for which to prepare the queryselect - String, the select containing the fields to retrieve and the table
This should be a valid ANSI-SQL `SELECT` statement without any conditions.
java.sql.SQLException - throws the Exception if generated by the prepareStatement
command in java.sql.Connection()Connection,
PreparedStatementpublic java.sql.PreparedStatement getScrollabeStatement(java.sql.Connection con,
java.lang.String select)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.ArrayList getParameters()
throws java.sql.SQLException
The index of the list -1 corresponds to the index of the parameter added
java.sql.SQLExceptionaddParameter(int, int),
addParameter(int, Object)public void setPreparedQuery(java.lang.String preparedQuery)
? to later set parameters to.
A prepared query is a query containing only the query for a table, with or without the "WHERE" keyword.
preparedQuery - The preparedQuery to setpublic java.lang.String getPreparedQuery()
public void addParameter(int idx,
java.lang.Object o)
idx - int, the placeholder positiono - Object, the value to set in the prepared statement.public void addParameter(int idx,
int i)
idx - int, the placeholder positioni - int, The value to set in the prepared statementpublic void addCondition(java.lang.String field,
java.lang.Object value)
null values
and makes them absolute so the condition will have a condition FIELD IS NULL
in the query.
The normal addCondition(String, Object) does not do this by default and
implementations can differ from data storage to data storage
converts java.util.Date to java.sql.Timestamp which is
appropriate for Oracle
addCondition in class Conditionfield - String, the identifiervalue - Object, the valueaddCondition(String, Object)public void addOrderBy(java.lang.String field,
boolean descending)
field - String, the field name as it occurs in the tabledescending - boolean, true if you want to sort descending.public boolean equals(java.lang.Object o)
public java.lang.Object clone()
clone in class java.lang.Objectpublic int getLastParameter()
public void setRecordLimit(int records)