public class SelectStatement extends Statement
SQL statement object, which contains parameter information about the Select statement in SQL.
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
FROM_WORD |
static int |
GROUP_WORD |
static short |
hashNum |
static int |
LIMIT_WORD |
static int |
ORDER_WORD |
static int |
SELECT_WORD |
static int |
WHERE_WORD |
COMMA_PATTERN, fieldNames, SPACE_PATTERN, tableName| 限定符 | 构造器和说明 |
|---|---|
protected |
SelectStatement(String tableName,
String selectStr,
String whereStr,
String groupStr,
String orderStr,
boolean asc,
String limitStr,
ArrayList<SelectStatement> SubQueryList) |
protected |
SelectStatement(String tableName,
String sql,
String selectStr,
String whereStr,
String groupStr,
String orderStr,
boolean asc,
String limitStr,
ArrayList<SelectStatement> SubQueryList) |
| 限定符和类型 | 方法和说明 |
|---|---|
static SelectStatementBuilder |
builder()
开始构建语句类对象,调用该方法也就意味着开始该类的建造,会返回对应的建造者对象。
|
String |
getSqlStr() |
String[] |
getStatementArrayByWord(String sqlWord)
按照SQL解析词获取到目标解析词下的sql语句的数组形式
|
String |
getStatementStrByWord(String sqlWord)
按照SQL解析词获取到目标解析词下的sql语句
|
ArrayList<SelectStatement> |
getSubQueryList()
获取到本次解析到的所有子查询语句
|
String[] |
getTables()
获取到本次查询涉及到的所有表名组成的数组数据。
|
String[] |
getWhereArray()
返回本次解析到的 where 子句中的条件数组,其中偶数位是子句的条件表达式。
|
protected int |
getWordNum(String sqlWord)
获取到解析词在sql语句中的编号数值,用于将解析词按照hash与阈值一起映射成为数值后,再进行解析词的匹配,这样的匹配性能会优秀很多,其中的编号数值阈值默认为当前语句对象的hashNum。
|
int |
isAsc() |
SelectStatement |
merge(SelectStatement selectStatement)
以当前类为中心,将其它sql语句类中的数据合并到当前类中,并返回当前类的新副本,不会影响当前类的源数据
|
String |
toString() |
getFieldNames, getTableName, getWordNumpublic static final short hashNum
public static final int SELECT_WORD
public static final int FROM_WORD
public static final int WHERE_WORD
public static final int GROUP_WORD
public static final int ORDER_WORD
public static final int LIMIT_WORD
protected SelectStatement(String tableName, String sql, String selectStr, String whereStr, String groupStr, String orderStr, boolean asc, String limitStr, ArrayList<SelectStatement> SubQueryList)
public static SelectStatementBuilder builder()
Start building statement class objects. Calling this method means starting the construction of this class, and the corresponding constructor object will be returned.
Generally speaking, if you do not extend the parser, the method will be called by the parser and the construction result will be returned to you.
public String[] getTables()
Get the array data composed of all table names involved in this query.
Group tableName data in a certain format to obtain a new array containing all table names.
protected int getWordNum(String sqlWord)
Get the number value of the parsed word in the sql statement, which is used to map the parsed word into a number by hash and threshold value, and then match the parsed word. The matching performance will be much better. The number value threshold value is the hashNum of the current statement object by default.
getWordNum 在类中 StatementsqlWord - 需要被转换的sql词public int isAsc()
If 1 is returned, it represents a positive ordering clause; if - 1 is returned, it represents a reverse ordering clause; if 0 is returned, it represents no sorting operation
public String getStatementStrByWord(String sqlWord)
getStatementStrByWord 在类中 StatementsqlWord - 需要获取的sql语句所属的解析词public String[] getStatementArrayByWord(String sqlWord)
getStatementArrayByWord 在类中 StatementsqlWord - 需要获取的sql语句所属的解析词public String[] getWhereArray()
public ArrayList<SelectStatement> getSubQueryList()
The list of SQL parsing result objects of each sub query statement. It is worth noting that this list is source data, and external modifications will affect the data in this class.
public SelectStatement merge(SelectStatement selectStatement)
selectStatement - 其它的sql语句类,也是另一方的数据来源Copyright © 2022. All rights reserved.