if (whereNode == null) {
// no where clause (select all rows)
result = new SQLExecutor.Select(domainTypeHandler, columnNames, queryDomainType);
} else {
// create a predicate from the tree
Predicate predicate = whereNode.getPredicate(queryDomainType);
if (predicate != null) {
// where clause that can be executed by clusterj
queryDomainType.where(predicate);
result = new SQLExecutor.Select(domainTypeHandler, columnNames, queryDomainType);
whereType = "clusterj";
} else {
// where clause that cannot be executed by clusterj
result = new SQLExecutor.Noop();
whereType = "non-clusterj";
}
if (logger.isDetailEnabled()) logger.detail(walk(root));
}
if (logger.isDetailEnabled()) {
logger.detail(
"SELECT FROM " + tableName
+ " COLUMNS " + columnNames + " whereType " + whereType);
logger.detail(walk(root));
}
break;
case MySQL51Parser.DELETE:
tableNode = (CommonTree)root.getFirstChildWithType(MySQL51Parser.TABLE);
tableName = getTableName(tableNode);
getSession();
dictionary = session.getDictionary();
domainTypeHandler = getDomainTypeHandler(tableName, dictionary);
whereNode = ((WhereNode)root.getFirstChildWithType(MySQL51Parser.WHERE));
int numberOfParameters = 0;
if (whereNode == null) {
// no where clause (delete all rows)
result = new SQLExecutor.Delete(domainTypeHandler);
whereType = "empty";
} else {
// create a predicate from the tree
queryDomainType = (QueryDomainTypeImpl<?>) session.createQueryDomainType(domainTypeHandler);
Predicate predicate = whereNode.getPredicate(queryDomainType);
if (predicate != null) {
// where clause that can be executed by clusterj
queryDomainType.where(predicate);
numberOfParameters = whereNode.getNumberOfParameters();
result = new SQLExecutor.Delete(domainTypeHandler, queryDomainType, numberOfParameters);