Search in sources :

Example 6 with SQLHint

use of com.alibaba.druid.sql.ast.SQLHint in project druid by alibaba.

the class OracleInsertStatement method cloneTo.

public void cloneTo(OracleInsertStatement x) {
    super.cloneTo(x);
    if (returning != null) {
        x.setReturning(returning.clone());
    }
    if (errorLogging != null) {
        x.setErrorLogging(errorLogging.clone());
    }
    for (SQLHint hint : hints) {
        SQLHint h2 = hint.clone();
        h2.setParent(x);
        x.hints.add(h2);
    }
}
Also used : SQLHint(com.alibaba.druid.sql.ast.SQLHint)

Example 7 with SQLHint

use of com.alibaba.druid.sql.ast.SQLHint in project sharding-jdbc by dangdangdotcom.

the class AbstractMySQLVisitor method visit.

private boolean visit(final SQLExprTableSource x, final Table table) {
    printToken(table.getName());
    if (table.getAlias().isPresent()) {
        print(' ');
        print(table.getAlias().get());
    }
    for (SQLHint each : x.getHints()) {
        print(' ');
        each.accept(this);
    }
    return false;
}
Also used : SQLHint(com.alibaba.druid.sql.ast.SQLHint)

Example 8 with SQLHint

use of com.alibaba.druid.sql.ast.SQLHint in project druid by alibaba.

the class OracleStatementParser method parseInsert0_hinits.

protected void parseInsert0_hinits(SQLInsertInto insertStatement) {
    if (insertStatement instanceof OracleInsertStatement) {
        OracleInsertStatement stmt = (OracleInsertStatement) insertStatement;
        this.getExprParser().parseHints(stmt.getHints());
    } else {
        List<SQLHint> hints = new ArrayList<SQLHint>(1);
        this.getExprParser().parseHints(hints);
    }
}
Also used : OracleInsertStatement(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleInsertStatement) ArrayList(java.util.ArrayList) SQLHint(com.alibaba.druid.sql.ast.SQLHint)

Example 9 with SQLHint

use of com.alibaba.druid.sql.ast.SQLHint in project druid by alibaba.

the class OracleStatementParser method parseInsert.

public OracleStatement parseInsert() {
    if (lexer.token() == Token.LPAREN) {
        OracleInsertStatement stmt = new OracleInsertStatement();
        parseInsert0(stmt, false);
        stmt.setReturning(parseReturningClause());
        stmt.setErrorLogging(parseErrorLoggingClause());
        return stmt;
    }
    accept(Token.INSERT);
    List<SQLHint> hints = new ArrayList<SQLHint>();
    parseHints(hints);
    if (lexer.token() == Token.INTO) {
        OracleInsertStatement stmt = new OracleInsertStatement();
        stmt.setHints(hints);
        parseInsert0(stmt);
        stmt.setReturning(parseReturningClause());
        stmt.setErrorLogging(parseErrorLoggingClause());
        return stmt;
    }
    OracleMultiInsertStatement stmt = parseMultiInsert();
    stmt.setHints(hints);
    return stmt;
}
Also used : OracleMultiInsertStatement(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleMultiInsertStatement) OracleInsertStatement(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleInsertStatement) ArrayList(java.util.ArrayList) SQLHint(com.alibaba.druid.sql.ast.SQLHint)

Example 10 with SQLHint

use of com.alibaba.druid.sql.ast.SQLHint in project druid by alibaba.

the class SQLLateralViewTableSource method clone.

@Override
public SQLLateralViewTableSource clone() {
    SQLLateralViewTableSource x = new SQLLateralViewTableSource();
    x.setAlias(this.alias);
    x.outer = outer;
    if (this.tableSource != null) {
        x.setTableSource(this.tableSource.clone());
    }
    if (this.method != null) {
        x.setMethod(this.method.clone());
    }
    for (SQLName column : this.columns) {
        SQLName e2 = column.clone();
        e2.setParent(x);
        x.getColumns().add(e2);
    }
    if (this.flashback != null) {
        x.setFlashback(this.flashback.clone());
    }
    if (this.hints != null) {
        for (SQLHint e : this.hints) {
            SQLHint e2 = e.clone();
            e2.setParent(x);
            x.getHints().add(e2);
        }
    }
    return x;
}
Also used : SQLName(com.alibaba.druid.sql.ast.SQLName) SQLHint(com.alibaba.druid.sql.ast.SQLHint)

Aggregations

SQLHint (com.alibaba.druid.sql.ast.SQLHint)11 SQLName (com.alibaba.druid.sql.ast.SQLName)2 OracleInsertStatement (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleInsertStatement)2 ArrayList (java.util.ArrayList)2 SQLParameter (com.alibaba.druid.sql.ast.SQLParameter)1 SQLListExpr (com.alibaba.druid.sql.ast.expr.SQLListExpr)1 MySqlOutputVisitor (com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor)1 OracleMultiInsertStatement (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleMultiInsertStatement)1