use of org.nutz.dao.impl.sql.pojo.StaticPItem in project nutz by nutzam.
the class NutSql method setSourceSql.
public void setSourceSql(String sql) {
this.sourceSql = sql;
SqlLiteral literal = literal();
this.varIndex = literal.getVarIndexes();
this.paramIndex = literal.getParamIndexes();
if (getSqlType() == null)
setSqlType(literal.getType());
String[] ss = literal.stack.cloneChain();
PItem[] tmp = new PItem[ss.length];
for (String var : varIndex.getOrders()) {
int[] is = varIndex.indexesOf(var);
if (is != null) {
for (int i : is) {
tmp[i] = new SqlVarPItem(var);
}
}
}
for (String param : paramIndex.getOrders()) {
int[] is = paramIndex.indexesOf(param);
if (is != null) {
for (int i : is) {
tmp[i] = new SqlParamPItem(param);
}
}
}
for (int i = 0; i < tmp.length; i++) {
if (tmp[i] == null) {
tmp[i] = new StaticPItem(ss[i], true);
}
}
this.items = Arrays.asList(tmp);
}
Aggregations