mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser. for issue #2080
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
|
||||
@@ -24,5 +25,8 @@ public interface SQLConstraint extends SQLObject {
|
||||
|
||||
void setName(SQLName value);
|
||||
|
||||
SQLExpr getComment();
|
||||
void setComment(SQLExpr x);
|
||||
|
||||
void simplify();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.sql.ast.SQLCommentHint;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
@@ -24,12 +25,12 @@ import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class SQLConstraintImpl extends SQLObjectImpl implements SQLConstraint {
|
||||
protected String dbType;
|
||||
|
||||
protected String dbType;
|
||||
protected SQLName name;
|
||||
private Boolean enable;
|
||||
private Boolean validate;
|
||||
private Boolean rely;
|
||||
protected Boolean enable;
|
||||
protected Boolean validate;
|
||||
protected Boolean rely;
|
||||
protected SQLExpr comment;
|
||||
|
||||
public List<SQLCommentHint> hints;
|
||||
|
||||
@@ -106,6 +107,17 @@ public abstract class SQLConstraintImpl extends SQLObjectImpl implements SQLCons
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public SQLExpr getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(SQLExpr x) {
|
||||
if (x != null) {
|
||||
x.setParent(this);
|
||||
}
|
||||
this.comment = x;
|
||||
}
|
||||
|
||||
public void simplify() {
|
||||
if (this.name instanceof SQLIdentifierExpr) {
|
||||
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) this.name;
|
||||
|
||||
@@ -92,9 +92,9 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
|
||||
|
||||
public static class ValuesClause extends SQLObjectImpl {
|
||||
|
||||
private final List<SQLExpr> values;
|
||||
|
||||
private transient String originalString;
|
||||
private final List<SQLExpr> values;
|
||||
private transient String originalString;
|
||||
private transient int replaceCount;
|
||||
|
||||
public ValuesClause(){
|
||||
this(new ArrayList<SQLExpr>());
|
||||
@@ -151,6 +151,14 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
|
||||
public void setOriginalString(String originalString) {
|
||||
this.originalString = originalString;
|
||||
}
|
||||
|
||||
public int getReplaceCount() {
|
||||
return replaceCount;
|
||||
}
|
||||
|
||||
public void incrementReplaceCount() {
|
||||
this.replaceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user