public class SqlQuery
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COL_MODIFY_IDX_SEPARATOR |
static java.lang.String |
VAR_PROP_SEPARATOR |
Constructor and Description |
---|
SqlQuery() |
Modifier and Type | Method and Description |
---|---|
void |
addFromElem(ValuePair vp)
Adds a from element to this select query
|
void |
addGroupElem(java.lang.String s)
Adds a group element to this select query
|
void |
addHavingElem(java.lang.String s)
Adds a having element to this select query
|
void |
addHintElem(java.lang.String h)
Adds a hint element to this select query
|
void |
addMatchModifySelectElem(ValuePair vp)
Adds a match modify select element to this select query
|
void |
addModifySelectElem(ValuePair vp)
Adds a modify select element to the current list
of modify select elements of this select query
|
void |
addModifySqlQueryElem(boolean addFromMatchQuery)
Adds a list of modify select elements to this select query
|
void |
addOrderElem(java.lang.String s)
Adds an order element to this select query
|
void |
addSelectElem(ValuePair vp)
Adds a select element to this select query
|
void |
addUnpivot(java.lang.String selectColumns,
java.lang.String forColumn,
java.lang.String unpivotColumns)
Creates an unpivot for this select query
|
void |
addUnpivotElem(java.lang.String elem)
Adds an unpivot element to the unpivot of this select query
|
void |
addUnpivotList()
Adds an unpivot list to the unpivot of this select query
|
void |
addWhereElem(java.lang.String s)
Adds a where element to this select query
|
void |
addWithClause(ValuePair vp)
Adds a with clause to this select query
|
java.lang.String[] |
buildMatchTranslation(boolean useExtdSize)
Builds the translation of the match clause
of this select query
|
java.lang.StringBuffer |
buildQueryUnpivot()
Builds an Unpivot SQL query string from populated
SQL query component lists.
|
java.lang.StringBuffer |
buildSQLModifyString(int idx)
Builds a SQL query string for modify from populated SQL query
component lists.
|
java.lang.StringBuffer |
buildSQLString()
Builds a SQL query string from populated SQL query component
lists.
|
java.lang.StringBuffer |
buildSQLString(java.util.List<ValuePair> selectElems,
java.util.List<ValuePair> fromElems,
java.util.List<java.lang.String> whereElems,
boolean addGroupBy,
boolean addOrderByAndLimit)
Builds a SQL query string from populated SQL query component
lists.
|
void |
clear() |
void |
moveMatchElemsToModify()
Moves the from elements and where elements of this
select query to every modify list
|
void |
putModifyFromElem(java.lang.Integer i,
ValuePair vp)
Adds a from element to the modify list at
given index in this select query
|
void |
putModifyWhereElem(java.lang.Integer i,
java.lang.String s)
Adds a where element to the modify list at
given index in this select query
|
void |
setDistinct(boolean distinct)
Sets if this select query has a distinct modifier
|
void |
setLimit(java.lang.String limit)
Sets the limit value of this select query
|
void |
setMatchTableName(java.lang.String matchTableName)
Sets the match table name of this select query
|
void |
setOffset(java.lang.String offset)
Sets the offset value of this select query
|
java.lang.String |
toString()
Prints elements of this select query
|
public static final java.lang.String COL_MODIFY_IDX_SEPARATOR
public static final java.lang.String VAR_PROP_SEPARATOR
public void addFromElem(ValuePair vp)
vp
- The from element to addpublic void addGroupElem(java.lang.String s)
s
- The group element to addpublic void addHavingElem(java.lang.String s)
s
- The having element to addpublic void addHintElem(java.lang.String h)
h
- The hint element to addpublic void addMatchModifySelectElem(ValuePair vp)
vp
- The match modify select element to addpublic void addModifySelectElem(ValuePair vp)
vp
- The modify select element to addpublic void addModifySqlQueryElem(boolean addFromMatchQuery)
addFromMatchQuery
- true if should add a select element
for the match tablepublic void addOrderElem(java.lang.String s)
s
- The order element to addpublic void addSelectElem(ValuePair vp)
vp
- The select element to addpublic void addUnpivot(java.lang.String selectColumns, java.lang.String forColumn, java.lang.String unpivotColumns)
selectColumns
- The select columns of the unpivotforColumn
- The for column of the unpivotunpivotColumns
- The unpivot columns of the unpivotpublic void addUnpivotElem(java.lang.String elem)
elem
- The unpivot element to addpublic void addUnpivotList()
public void addWhereElem(java.lang.String s)
s
- The where element to addpublic void addWithClause(ValuePair vp)
vp
- The with clause to addpublic java.lang.String[] buildMatchTranslation(boolean useExtdSize)
useExtdSize
- true if should use extended size for nvarchar columnspublic java.lang.StringBuffer buildQueryUnpivot()
public java.lang.StringBuffer buildSQLModifyString(int idx)
idx
- The index of the modify to buildpublic java.lang.StringBuffer buildSQLString()
public java.lang.StringBuffer buildSQLString(java.util.List<ValuePair> selectElems, java.util.List<ValuePair> fromElems, java.util.List<java.lang.String> whereElems, boolean addGroupBy, boolean addOrderByAndLimit)
selectElems
- The select elements for the queryfromElems
- The from elements for the querywhereElems
- The where elements for the queryaddGroupBy
- true if should add a group by clauseaddOrderByAndLimit
- true if should add order by and limit clausespublic void clear()
public void moveMatchElemsToModify()
public void putModifyFromElem(java.lang.Integer i, ValuePair vp)
i
- The index of the modify listvp
- The modify from element to addpublic void putModifyWhereElem(java.lang.Integer i, java.lang.String s)
i
- The index of the modify lists
- The modify where element to addpublic void setDistinct(boolean distinct)
distinct
- Set to true if this select should have
a distinct modifierpublic void setLimit(java.lang.String limit)
limit
- The limit value to setpublic void setMatchTableName(java.lang.String matchTableName)
matchTableName
- The match table namepublic void setOffset(java.lang.String offset)
offset
- The offset value to setpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015 - 2020 Oracle and/or its affiliates. All Rights Reserved.