本文整理汇总了Java中com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock类的典型用法代码示例。如果您正苦于以下问题:Java SQLServerSelectQueryBlock类的具体用法?Java SQLServerSelectQueryBlock怎么用?Java SQLServerSelectQueryBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLServerSelectQueryBlock类属于com.alibaba.druid.sql.dialect.sqlserver.ast包,在下文中一共展示了SQLServerSelectQueryBlock类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sqlserverParse
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
private void sqlserverParse(SchemaConfig schema, RouteResultset rrs)
{
//使用sqlserver的解析,否则会有部分语法识别错误
SQLServerStatementParser oracleParser = new SQLServerStatementParser(getCtx().getSql());
SQLSelectStatement oracleStmt = (SQLSelectStatement) oracleParser.parseStatement();
SQLSelectQuery oracleSqlSelectQuery = oracleStmt.getSelect().getQuery();
if(oracleSqlSelectQuery instanceof SQLServerSelectQueryBlock)
{
parseSqlServerPageSql(oracleStmt, rrs, (SQLServerSelectQueryBlock) oracleSqlSelectQuery, schema);
if(isNeedParseOrderAgg)
{
parseOrderAggGroupSqlServer(schema, oracleStmt,rrs, (SQLServerSelectQueryBlock) oracleSqlSelectQuery);
}
}
}
示例2: createSelectQueryBlock
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
protected SQLSelectQuery createSelectQueryBlock() {
if (JdbcConstants.MYSQL.equals(dbType)) {
return new MySqlSelectQueryBlock();
}
if (JdbcConstants.POSTGRESQL.equals(dbType)) {
return new PGSelectQueryBlock();
}
if (JdbcConstants.SQL_SERVER.equals(dbType)) {
return new SQLServerSelectQueryBlock();
}
if (JdbcConstants.ORACLE.equals(dbType)) {
return new OracleSelectQueryBlock();
}
return new SQLSelectQueryBlock();
}
示例3: toPage
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
protected BindSql toPage(PageLimit offsetLimit, SQLServerSelectQueryBlock selectBody, SQLSelect select, String raw) {
SQLOrderBy order = select.getOrderBy();
if (order == null) {
throw new UnsupportedOperationException("Select must have order to page");
}
SQLServerTop top=new SQLServerTop();
top.setExpr(new SQLIntegerExpr(offsetLimit.getEnd()));
selectBody.setTop(top);
StringBuilder sb = new StringBuilder(raw.length() + 30);
//sb.append("SELECT TOP ").append(offsetLimit[1]).append(" * FROM (");
SQLServerOutputVisitor visitor=new SQLServerOutputVisitor(sb);
visitor.setPrettyFormat(false);
select.accept(visitor);
//sb.append(") __ef_t");
//appendOrderReverse(order,visitor, "__ef_t", selectBody.getSelectList());
return new BindSql(sb.toString()).setReverseResult(new ResultSetLaterProcess(offsetLimit.getOffset()));
}
示例4: toPage
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
@Override
protected BindSql toPage(PageLimit offsetLimit, SQLServerSelectQueryBlock selectBody, SQLSelect select, String raw) {
SQLOrderBy order = select.getOrderBy();
if (order == null) {
order = defaultOrder;
} else {
select.setOrderBy(null);
}
SQLAggregateExpr arg=new SQLAggregateExpr("row_number");
SQLOver over=new SQLOver();
over.setOrderBy(order);
arg.setOver(over);
selectBody.getSelectList().add(0, new SQLSelectItem(arg, "__rn"));
StringBuilder sb = new StringBuilder("SELECT _tmp1.* FROM (");
SQLServerOutputVisitor visitor=new SQLServerOutputVisitor(sb);
visitor.setPrettyFormat(false);
select.accept(visitor);
sb.append(") _tmp1 WHERE __rn between ");
sb.append(offsetLimit.getOffset() + 1).append(" and ").append(offsetLimit.getEnd());
return new BindSql(sb.toString());
}
示例5: parseOrderAggGroupSqlServer
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
private void parseOrderAggGroupSqlServer(SchemaConfig schema, SQLStatement stmt, RouteResultset rrs, SQLServerSelectQueryBlock mysqlSelectQuery)
{
Map<String, String> aliaColumns = parseAggGroupCommon(schema, stmt,rrs, mysqlSelectQuery);
SQLServerSelect oracleSelect= (SQLServerSelect) mysqlSelectQuery.getParent();
if(oracleSelect.getOrderBy() != null) {
List<SQLSelectOrderByItem> orderByItems = oracleSelect.getOrderBy().getItems();
rrs.setOrderByCols(buildOrderByCols(orderByItems,aliaColumns));
}
}
示例6: createQueryBlock
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
private static SQLSelectQueryBlock createQueryBlock(String dbType) {
if (JdbcConstants.MYSQL.equals(dbType)
|| JdbcConstants.MARIADB.equals(dbType)
|| JdbcConstants.ALIYUN_ADS.equals(dbType)) {
return new MySqlSelectQueryBlock();
}
if (JdbcConstants.MARIADB.equals(dbType)) {
return new MySqlSelectQueryBlock();
}
if (JdbcConstants.H2.equals(dbType)) {
return new MySqlSelectQueryBlock();
}
if (JdbcConstants.ORACLE.equals(dbType)) {
return new OracleSelectQueryBlock();
}
if (JdbcConstants.POSTGRESQL.equals(dbType)) {
return new PGSelectQueryBlock();
}
if (JdbcConstants.SQL_SERVER.equals(dbType) || JdbcConstants.JTDS.equals(dbType)) {
return new SQLServerSelectQueryBlock();
}
if (JdbcConstants.DB2.equals(dbType)) {
return new DB2SelectQueryBlock();
}
return new SQLSelectQueryBlock();
}
示例7: processToPageSQL
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
private BindSql processToPageSQL(String sql, PageLimit offsetLimit) {
SQLServerSelectParser parser = new SQLServerSelectParser(sql);
try{
SQLSelect select = parser.select();
if(select.getQuery() instanceof SQLUnionQuery){
return toPage(offsetLimit,(SQLUnionQuery)select.getQuery(),select,sql);
}else{
return toPage(offsetLimit,(SQLServerSelectQueryBlock)select.getQuery(),select ,sql);
}
}catch(ParserException ex){
LogUtil.error(sql, ex);
throw ex;
}
}
示例8: query
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
public SQLSelectQuery query() {
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
SQLSelectQuery select = query();
accept(Token.RPAREN);
return queryRest(select);
}
SQLServerSelectQueryBlock queryBlock = new SQLServerSelectQueryBlock();
if (lexer.token() == Token.SELECT) {
lexer.nextToken();
if (lexer.token() == Token.COMMENT) {
lexer.nextToken();
}
if (lexer.token() == Token.DISTINCT) {
queryBlock.setDistionOption(SQLSetQuantifier.DISTINCT);
lexer.nextToken();
} else if (lexer.token() == Token.ALL) {
queryBlock.setDistionOption(SQLSetQuantifier.ALL);
lexer.nextToken();
}
if (lexer.token() == Token.TOP) {
SQLServerTop top = this.createExprParser().parseTop();
queryBlock.setTop(top);
}
parseSelectList(queryBlock);
}
if (lexer.token() == Token.INTO) {
lexer.nextToken();
SQLTableSource into = this.parseTableSource();
queryBlock.setInto((SQLExprTableSource) into);
}
parseFrom(queryBlock);
parseWhere(queryBlock);
parseGroupBy(queryBlock);
queryBlock.setOrderBy(this.exprParser.parseOrderBy());
parseFetchClause(queryBlock);
return queryRest(queryBlock);
}
示例9: visit
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
@Override
public boolean visit(SQLServerSelectQueryBlock x) {
return true;
}
示例10: visit
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
public boolean visit(SQLServerSelectQueryBlock x) {
print0(ucase ? "SELECT " : "select ");
if (SQLSetQuantifier.ALL == x.getDistionOption()) {
print0(ucase ? "ALL " : "all ");
} else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) {
print0(ucase ? "DISTINCT " : "distinct ");
} else if (SQLSetQuantifier.UNIQUE == x.getDistionOption()) {
print0(ucase ? "UNIQUE " : "unique ");
}
SQLServerTop top = x.getTop();
if (top != null) {
visit(top);
print(' ');
}
printSelectList(x.getSelectList());
SQLExprTableSource into = x.getInto();
if (into != null) {
println();
print0(ucase ? "INTO " : "into ");
printTableSource(into);
}
SQLTableSource from = x.getFrom();
if (from != null) {
println();
print0(ucase ? "FROM " : "from ");
printTableSource(from);
}
SQLExpr where = x.getWhere();
if (where != null) {
println();
print0(ucase ? "WHERE " : "where ");
printExpr(where);
}
SQLSelectGroupByClause groupBy = x.getGroupBy();
if (groupBy != null) {
println();
visit(groupBy);
}
SQLOrderBy orderBy = x.getOrderBy();
if (orderBy != null) {
println();
visit(orderBy);
}
printFetchFirst(x);
return false;
}
示例11: endVisit
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
@Override
public void endVisit(SQLServerSelectQueryBlock x) {
}
示例12: visit
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
boolean visit(SQLServerSelectQueryBlock x);
示例13: endVisit
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock; //导入依赖的package包/类
void endVisit(SQLServerSelectQueryBlock x);