mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
insert语句增加default values支持
example: insert into test01 DEFAULT VALUES
This commit is contained in:
+10
-1
@@ -29,6 +29,7 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
|
||||
private PGWithClause with;
|
||||
private List<ValuesClause> valuesList = new ArrayList<ValuesClause>();
|
||||
private SQLExpr returning;
|
||||
private boolean defaultValues = false;
|
||||
|
||||
public SQLExpr getReturning() {
|
||||
return returning;
|
||||
@@ -70,7 +71,15 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
|
||||
valuesList.add(valueClause);
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
public boolean isDefaultValues() {
|
||||
return defaultValues;
|
||||
}
|
||||
|
||||
public void setDefaultValues(boolean defaultValues) {
|
||||
this.defaultValues = defaultValues;
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((PGASTVisitor) visitor);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -100,6 +100,12 @@ public class PGSQLStatementParser extends SQLStatementParser {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.DEFAULT) {
|
||||
lexer.nextToken();
|
||||
accept(Token.VALUES);
|
||||
stmt.setDefaultValues(true);
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.LPAREN)) {
|
||||
lexer.nextToken();
|
||||
|
||||
Reference in New Issue
Block a user