mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
+9
@@ -30,6 +30,7 @@ public class MySqlInsertStatement extends SQLInsertStatement {
|
||||
private boolean delayed = false;
|
||||
private boolean highPriority = false;
|
||||
private boolean ignore = false;
|
||||
private boolean rollbackOnFail = false;
|
||||
|
||||
private final List<SQLExpr> duplicateKeyUpdate = new ArrayList<SQLExpr>();
|
||||
|
||||
@@ -69,6 +70,14 @@ public class MySqlInsertStatement extends SQLInsertStatement {
|
||||
this.ignore = ignore;
|
||||
}
|
||||
|
||||
public boolean isRollbackOnFail() {
|
||||
return rollbackOnFail;
|
||||
}
|
||||
|
||||
public void setRollbackOnFail(boolean rollbackOnFail) {
|
||||
this.rollbackOnFail = rollbackOnFail;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor instanceof MySqlASTVisitor) {
|
||||
|
||||
@@ -249,11 +249,17 @@ public class MySqlLexer extends Lexer {
|
||||
|
||||
mark = pos;
|
||||
bufPos = 1;
|
||||
char ch;
|
||||
char ch = '\0', last_ch;
|
||||
for (;;) {
|
||||
last_ch = ch;
|
||||
ch = charAt(++pos);
|
||||
|
||||
if (!isIdentifierChar(ch)) {
|
||||
if (last_ch == '-' && charAt(pos-2) != '-') {
|
||||
ch = last_ch;
|
||||
bufPos--;
|
||||
pos--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+29
-15
@@ -1936,24 +1936,38 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
if (lexer.token() == Token.INSERT) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (identifierEquals(LOW_PRIORITY)) {
|
||||
insertStatement.setLowPriority(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
for (;;) {
|
||||
if (identifierEquals(LOW_PRIORITY)) {
|
||||
insertStatement.setLowPriority(true);
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identifierEquals(DELAYED)) {
|
||||
insertStatement.setDelayed(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals(DELAYED)) {
|
||||
insertStatement.setDelayed(true);
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identifierEquals("HIGH_PRIORITY")) {
|
||||
insertStatement.setHighPriority(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals("HIGH_PRIORITY")) {
|
||||
insertStatement.setHighPriority(true);
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identifierEquals(IGNORE)) {
|
||||
insertStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
if (identifierEquals(IGNORE)) {
|
||||
insertStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identifierEquals("ROLLBACK_ON_FAIL")) {
|
||||
insertStatement.setRollbackOnFail(true);
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.INTO) {
|
||||
|
||||
@@ -941,6 +941,10 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
if (x.isIgnore()) {
|
||||
print0(ucase ? "IGNORE " : "ignore ");
|
||||
}
|
||||
|
||||
if (x.isRollbackOnFail()) {
|
||||
print0(ucase ? "ROLLBACK_ON_FAIL " : "rollback_on_fail ");
|
||||
}
|
||||
|
||||
print0(ucase ? "INTO " : "into ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user