public class SqlServerParser extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
PAGE_COLUMN_ALIAS_PREFIX |
protected static String |
PAGE_ROW_NUMBER |
protected static net.sf.jsqlparser.schema.Column |
PAGE_ROW_NUMBER_COLUMN |
static String |
PAGE_SIZE |
static net.sf.jsqlparser.expression.Alias |
PAGE_TABLE_ALIAS |
protected static String |
PAGE_TABLE_NAME |
static String |
START_ROW |
protected static net.sf.jsqlparser.statement.select.Top |
TOP100_PERCENT |
protected static String |
WRAP_TABLE |
Constructor and Description |
---|
SqlServerParser() |
Modifier and Type | Method and Description |
---|---|
protected net.sf.jsqlparser.statement.select.SelectItem |
addRowNumber(net.sf.jsqlparser.statement.select.PlainSelect plainSelect,
List<net.sf.jsqlparser.statement.select.SelectItem> autoItems)
获取 ROW_NUMBER() 列
|
protected net.sf.jsqlparser.statement.select.OrderByElement |
cloneOrderByElement(net.sf.jsqlparser.statement.select.OrderByElement orig,
net.sf.jsqlparser.expression.Expression expression)
复制 OrderByElement
|
protected net.sf.jsqlparser.statement.select.OrderByElement |
cloneOrderByElement(net.sf.jsqlparser.statement.select.OrderByElement orig,
String alias)
复制 OrderByElement
|
String |
convertToPageSql(String sql)
转换为分页语句
|
String |
convertToPageSql(String sql,
Integer offset,
Integer limit)
转换为分页语句
|
protected List<net.sf.jsqlparser.statement.select.OrderByElement> |
getOrderByElements(net.sf.jsqlparser.statement.select.PlainSelect plainSelect,
List<net.sf.jsqlparser.statement.select.SelectItem> autoItems)
获取新的排序列表
|
protected net.sf.jsqlparser.statement.select.Select |
getPageSelect(net.sf.jsqlparser.statement.select.Select select)
获取一个外层包装的TOP查询
|
protected List<net.sf.jsqlparser.statement.select.SelectItem> |
getSelectItems(net.sf.jsqlparser.statement.select.PlainSelect plainSelect)
获取查询列
|
boolean |
isNotEmptyList(List<?> list)
List不空
|
protected void |
processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem,
int level)
处理子查询
|
protected void |
processPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect,
int level)
处理PlainSelect类型的selectBody
|
protected void |
processSelectBody(net.sf.jsqlparser.statement.select.SelectBody selectBody,
int level)
处理selectBody去除Order by
|
protected net.sf.jsqlparser.statement.select.SelectBody |
wrapSetOperationList(net.sf.jsqlparser.statement.select.SetOperationList setOperationList)
包装SetOperationList
|
public static final String START_ROW
public static final String PAGE_SIZE
protected static final String WRAP_TABLE
protected static final String PAGE_TABLE_NAME
public static final net.sf.jsqlparser.expression.Alias PAGE_TABLE_ALIAS
protected static final String PAGE_ROW_NUMBER
protected static final net.sf.jsqlparser.schema.Column PAGE_ROW_NUMBER_COLUMN
protected static final net.sf.jsqlparser.statement.select.Top TOP100_PERCENT
protected static final String PAGE_COLUMN_ALIAS_PREFIX
public String convertToPageSql(String sql, Integer offset, Integer limit)
sql
- offset
- limit
- protected net.sf.jsqlparser.statement.select.Select getPageSelect(net.sf.jsqlparser.statement.select.Select select)
select
- protected net.sf.jsqlparser.statement.select.SelectBody wrapSetOperationList(net.sf.jsqlparser.statement.select.SetOperationList setOperationList)
setOperationList
- protected List<net.sf.jsqlparser.statement.select.SelectItem> getSelectItems(net.sf.jsqlparser.statement.select.PlainSelect plainSelect)
plainSelect
- protected net.sf.jsqlparser.statement.select.SelectItem addRowNumber(net.sf.jsqlparser.statement.select.PlainSelect plainSelect, List<net.sf.jsqlparser.statement.select.SelectItem> autoItems)
plainSelect
- 原查询autoItems
- 自动生成的查询列protected void processSelectBody(net.sf.jsqlparser.statement.select.SelectBody selectBody, int level)
selectBody
- protected void processPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect, int level)
plainSelect
- protected void processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem, int level)
fromItem
- public boolean isNotEmptyList(List<?> list)
list
- protected net.sf.jsqlparser.statement.select.OrderByElement cloneOrderByElement(net.sf.jsqlparser.statement.select.OrderByElement orig, String alias)
orig
- 原 OrderByElementalias
- 新 OrderByElement 的排序要素protected net.sf.jsqlparser.statement.select.OrderByElement cloneOrderByElement(net.sf.jsqlparser.statement.select.OrderByElement orig, net.sf.jsqlparser.expression.Expression expression)
orig
- 原 OrderByElementexpression
- 新 OrderByElement 的排序要素protected List<net.sf.jsqlparser.statement.select.OrderByElement> getOrderByElements(net.sf.jsqlparser.statement.select.PlainSelect plainSelect, List<net.sf.jsqlparser.statement.select.SelectItem> autoItems)
plainSelect
- 原始查询autoItems
- 生成的新查询要素Copyright © 2018. All rights reserved.