public class SQLBuilder extends Object implements Appendable, Cloneable
Constructor and Description |
---|
SQLBuilder() |
Modifier and Type | Method and Description |
---|---|
Appendable |
append(char c) |
Appendable |
append(CharSequence sql) |
Appendable |
append(CharSequence sql,
int start,
int end) |
void |
appendToken(String token)
增加占位符.
|
void |
appendToken(String label,
String token)
增加占位符.
|
void |
buildSQL(String label,
String token)
用实际的值替代占位符.
|
void |
buildSQL(String label,
String token,
boolean isDerived)
用实际的值替代占位符,并可以标记该SQL是否为派生SQL.
|
SQLBuilder |
buildSQLWithNewToken()
用实际的值替代占位符,并返回新的构建器.
|
boolean |
isChanged() |
void |
recordNewToken(String label,
String token)
记录新的Token.
|
void |
removeDerivedSQL()
移除衍生的SQL片段.
|
String |
toSQL()
生成SQL语句.
|
String |
toString() |
public void appendToken(String token)
token
- 占位符public boolean isChanged()
public void appendToken(String label, String token)
label
- 占位符标签token
- 占位符public void buildSQL(String label, String token)
label
- 占位符token
- 实际的值public void buildSQL(String label, String token, boolean isDerived)
label
- 占位符token
- 实际的值isDerived
- 是否是派生的SQLpublic void recordNewToken(String label, String token)
label
- 占位符token
- 实际的值public SQLBuilder buildSQLWithNewToken()
public String toSQL()
public Appendable append(CharSequence sql) throws IOException
append
in interface Appendable
IOException
public Appendable append(CharSequence sql, int start, int end) throws IOException
append
in interface Appendable
IOException
public Appendable append(char c) throws IOException
append
in interface Appendable
IOException
public void removeDerivedSQL()
Copyright © 2006–2018 TinyGroup. All rights reserved.