use of com.wplatform.ddal.util.StatementBuilder in project jdbc-shards by wplatform.
the class ConditionIn method getSQL.
@Override
public String getSQL() {
StatementBuilder buff = new StatementBuilder("(");
buff.append(left.getSQL()).append(" IN(");
for (Expression e : valueList) {
buff.appendExceptFirst(", ");
buff.append(e.getSQL());
}
return buff.append("))").toString();
}
use of com.wplatform.ddal.util.StatementBuilder in project jdbc-shards by wplatform.
the class ConditionInConstantSet method exportParameters.
@Override
public String exportParameters(TableFilter filter, List<Value> container) {
StatementBuilder buff = new StatementBuilder("(");
buff.append(left.exportParameters(filter, container)).append(" IN(");
for (Expression e : valueList) {
buff.appendExceptFirst(", ");
buff.append(e.exportParameters(filter, container));
}
return buff.append("))").toString();
}
use of com.wplatform.ddal.util.StatementBuilder in project jdbc-shards by wplatform.
the class Insert method getPlanSQL.
@Override
public String getPlanSQL() {
StatementBuilder buff = new StatementBuilder("INSERT INTO ");
buff.append(table.getSQL()).append('(');
for (Column c : columns) {
buff.appendExceptFirst(", ");
buff.append(c.getSQL());
}
buff.append(")\n");
if (insertFromSelect) {
buff.append("DIRECT ");
}
if (sortedInsertMode) {
buff.append("SORTED ");
}
if (list.size() > 0) {
buff.append("VALUES ");
int row = 0;
if (list.size() > 1) {
buff.append('\n');
}
for (Expression[] expr : list) {
if (row++ > 0) {
buff.append(",\n");
}
buff.append('(');
buff.resetCount();
for (Expression e : expr) {
buff.appendExceptFirst(", ");
if (e == null) {
buff.append("DEFAULT");
} else {
buff.append(e.getSQL());
}
}
buff.append(')');
}
} else {
buff.append(query.getPlanSQL());
}
return buff.toString();
}
use of com.wplatform.ddal.util.StatementBuilder in project jdbc-shards by wplatform.
the class ExpressionList method getSQL.
@Override
public String getSQL() {
StatementBuilder buff = new StatementBuilder("(");
for (Expression e : list) {
buff.appendExceptFirst(", ");
buff.append(e.getSQL());
}
if (list.length == 1) {
buff.append(',');
}
return buff.append(')').toString();
}
use of com.wplatform.ddal.util.StatementBuilder in project jdbc-shards by wplatform.
the class FunctionAlias method getMethodSignature.
private static String getMethodSignature(Method m) {
StatementBuilder buff = new StatementBuilder(m.getName());
buff.append('(');
for (Class<?> p : m.getParameterTypes()) {
// do not use a space here, because spaces are removed
// in CreateFunctionAlias.setJavaClassMethod()
buff.appendExceptFirst(",");
if (p.isArray()) {
buff.append(p.getComponentType().getName()).append("[]");
} else {
buff.append(p.getName());
}
}
return buff.append(')').toString();
}
Aggregations