Package org.fugerit.java.core.db.daogen
Class QueryHelper
- java.lang.Object
-
- org.fugerit.java.core.db.daogen.BasicHelper
-
- org.fugerit.java.core.db.daogen.QueryHelper
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DeleteHelper
,InsertHelper
,SelectHelper
,UpdateHelper
public class QueryHelper extends BasicHelper
QueryHelper is basically a wrapper which encapsulates information needed to setup ajava.sql.PreparedStatement
. This is achieved by use of a query buffer (getQuery()) and a list of field (getFields()) Here is a very simple example :QueryHelper helper = new QueryHelper( "sample_table", new FieldList() ); helper.get
- Author:
- Matteo Franci a.k.a. Fugerit
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLOSE_PARA
Constant for ')'static String
OPEN_PARA
Constant for '('static String
QUESTION_MARK
Constant for '?'static String
WHITESPACE
Constant for ' '-
Fields inherited from class org.fugerit.java.core.db.daogen.BasicHelper
UNSOPPORTED_OPERATION
-
-
Constructor Summary
Constructors Constructor Description QueryHelper(String table, FieldList fl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryHelper
append(String s)
void
appendToQuery(String s)
void
appendToQueryWithSpace(String s)
QueryHelper
appendWithSpace(String s)
void
closePara()
Add ')' to query bufferFieldList
getFields()
Getter method for the field listStringBuilder
getQuery()
Getter method for the query bufferString
getQueryContent()
Builds the query context of all query buffer.String
getTable()
void
openPara()
Add '(' to query buffer-
Methods inherited from class org.fugerit.java.core.db.daogen.BasicHelper
throwUnsupported
-
-
-
-
Field Detail
-
OPEN_PARA
public static final String OPEN_PARA
Constant for '('- See Also:
- Constant Field Values
-
CLOSE_PARA
public static final String CLOSE_PARA
Constant for ')'- See Also:
- Constant Field Values
-
QUESTION_MARK
public static final String QUESTION_MARK
Constant for '?'- See Also:
- Constant Field Values
-
WHITESPACE
public static final String WHITESPACE
Constant for ' '- See Also:
- Constant Field Values
-
-
Method Detail
-
openPara
public void openPara()
Add '(' to query buffer
-
closePara
public void closePara()
Add ')' to query buffer
-
getQuery
public StringBuilder getQuery()
Getter method for the query buffer- Returns:
- the query buffer
-
getFields
public FieldList getFields()
Getter method for the field list- Returns:
- the field list
-
getTable
public String getTable()
-
append
public QueryHelper append(String s)
-
appendWithSpace
public QueryHelper appendWithSpace(String s)
-
appendToQuery
public void appendToQuery(String s)
-
appendToQueryWithSpace
public void appendToQueryWithSpace(String s)
-
getQueryContent
public String getQueryContent()
Builds the query context of all query buffer. (To be preferred to getQuery().toString() method).- Returns:
- the current query content
-
-