com.scudata.expression.fn.Create Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.expression.fn;
import java.util.ArrayList;
import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.dm.Table;
import com.scudata.expression.Expression;
import com.scudata.expression.Function;
import com.scudata.expression.Node;
import com.scudata.resources.EngineMessage;
/**
* create(Fi,...)??????Fi,??Ϊ?ֶεĿ????
* @author runqian
*
*/
public class Create extends Function {
public Node optimize(Context ctx) {
return this;
}
public Object calculate(Context ctx) {
if (param == null) {
MessageManager mm = EngineMessage.get();
throw new RQException("create" + mm.getMessage("function.missingParam"));
}
Expression []exps = getParamExpressions("create", true);
int size = exps.length;
String []names = new String[size];
ArrayList pkList = null;
for (int i = 0; i < size; ++i) {
if (exps[i] != null) {
String name = exps[i].getIdentifierName();
if (name != null && name.length() > 0 && name.charAt(0) == '#') {
name = name.substring(1);
if (pkList == null) {
pkList = new ArrayList();
}
pkList.add(name);
}
names[i] = name;
}
}
Table table = new Table(names);
if (pkList != null) {
int count = pkList.size();
String []pkNames = new String[count];
pkList.toArray(pkNames);
table.setPrimary(pkNames);
}
return table;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy