in empire-db/src/main/java/org/apache/empire/db/DBCommand.java [150:183]
public DBCommand clone()
{
DBCommand clone = (DBCommand)super.clone();
// Clone lists
if (select!=null)
clone.select = new ArrayList<DBColumnExpr>(select);
if (set!=null)
clone.set = new ArrayList<DBSetExpr>(set);
if (joins!=null)
clone.joins = new ArrayList<DBJoinExpr>(joins);
if (where!=null)
clone.where = new ArrayList<DBCompareExpr>(where);
if (groupBy!=null)
clone.groupBy = new ArrayList<DBColumnExpr>(groupBy);
if (having!=null)
clone.having = new ArrayList<DBCompareExpr>(having);
// clone params
clone.cmdParams = new DBCmdParamList(cmdParams.size());
if (!cmdParams.isEmpty())
{ // clone set
for (int i=0; (clone.set!=null && i<clone.set.size()); i++)
clone.set.set(i, clone.set.get(i).copy(clone));
// clone joins
for (int i=0; (clone.joins!=null && i<clone.joins.size()); i++)
clone.joins.set(i, clone.joins.get(i).copy(clone));
// clone where and having
for (int i=0; (clone.where!=null && i<clone.where.size()); i++)
clone.where.set(i, clone.where.get(i).copy(clone));
for (int i=0; (clone.having!=null && i<clone.having.size()); i++)
clone.having.set(i, clone.having.get(i).copy(clone));
}
// done
return clone;
}