本文整理汇总了Java中com.taobao.tddl.executor.utils.ExecUtils.copyOrderBys方法的典型用法代码示例。如果您正苦于以下问题:Java ExecUtils.copyOrderBys方法的具体用法?Java ExecUtils.copyOrderBys怎么用?Java ExecUtils.copyOrderBys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.utils.ExecUtils
的用法示例。
在下文中一共展示了ExecUtils.copyOrderBys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOrderBy
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
public static List<IOrderBy> buildOrderBy(IDataNodeExecutor executor, IndexMeta indexMeta, String tableName) {
IQuery query = ((IQuery) executor);
List<IOrderBy> orderBy = null;
orderBy = query.getOrderBys();
if (orderBy == null || orderBy.isEmpty()) {
List<IOrderBy> groupBys = query.getGroupBys();
orderBy = groupBys;
}
if (orderBy == null || orderBy.isEmpty()) {
orderBy = ExecUtils.getOrderBy(indexMeta);
}
List<IOrderBy> orderbys = ExecUtils.copyOrderBys(orderBy);
return orderbys;
}
示例2: handle
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {
if (!canComposeOneSql(executor)) {
return super.handle(executor, executionContext);
}
IndexMeta indexMeta = null;
My_JdbcHandler jdbcHandler = MysqlRepoUtils.getJdbcHandler(dsGetter, executor, executionContext);
ICursorMeta meta = ExecUtils.convertToICursorMeta((IQueryTree) executor);
My_Cursor my_cursor = new My_Cursor(jdbcHandler, meta, executor, executor.isStreaming());
// if (executor.getSql() != null) {
// // TODO shenxun : 排序信息似乎丢了啊。。
// return my_cursor.getResultSet();
// }
List<IOrderBy> orderBy = null;
if (executor instanceof IJoin) {
orderBy = ((IJoin) executor).getOrderBys();
} else {
orderBy = MysqlRepoUtils.buildOrderBy(executor, indexMeta);
}
orderBy = ExecUtils.copyOrderBys(orderBy);
for (IOrderBy order : orderBy) {
if (((IQueryTree) executor).getAlias() != null) {
order.getColumn().setTableName(((IQueryTree) executor).getAlias());
}
if (order.getColumn().getAlias() != null) order.getColumn().setColumnName(order.getColumn().getAlias());
}
if (GeneralUtil.getExtraCmdBoolean(executionContext.getExtraCmds(), ExtraCmd.EXECUTE_QUERY_WHEN_CREATED, false)) {
my_cursor.init();
}
return new SchematicMyCursor(my_cursor, meta, orderBy);
}
示例3: handle
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {
if (!canComposeOneSql(executor)) {
return super.handle(executor, executionContext);
}
IndexMeta indexMeta = null;
My_JdbcHandler jdbcHandler = ((My_Repository) executionContext.getCurrentRepository()).getJdbcHandler(dsGetter,
executor,
executionContext);
ICursorMeta meta = ExecUtils.convertToICursorMeta((IQueryTree) executor);
My_Cursor my_cursor = new My_Cursor(jdbcHandler, meta, executor, executor.isStreaming());
if (executor.getSql() != null) {
return my_cursor.getResultSet();
}
List<IOrderBy> orderBy = null;
if (executor instanceof IJoin) {
orderBy = ((IJoin) executor).getOrderBys();
} else {
orderBy = MysqlRepoUtils.buildOrderBy(executor, indexMeta);
}
orderBy = ExecUtils.copyOrderBys(orderBy);
for (IOrderBy order : orderBy) {
if (((IQueryTree) executor).getAlias() != null) {
order.getColumn().setTableName(((IQueryTree) executor).getAlias());
}
if (order.getColumn().getAlias() != null) order.getColumn().setColumnName(order.getColumn().getAlias());
}
if (!executor.lazyLoad()) {
my_cursor.init();
}
ISchematicCursor cursor = new SchematicMyCursor(my_cursor, meta, orderBy);
if (((IQueryTree) executor).getSubqueryFilter() != null) {
cursor = executionContext.getCurrentRepository()
.getCursorFactory()
.valueFilterCursor(executionContext, cursor, ((IQueryTree) executor).getSubqueryFilter());
}
return cursor;
}