insert语句增加default values支持

example:
insert into test01 DEFAULT VALUES
This commit is contained in:
huangtiande
2015-02-06 10:17:53 +08:00
parent 4ed063711e
commit 0b9b02cd99
3 changed files with 28 additions and 2 deletions
@@ -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);
}
@@ -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();