Merge pull request #24 from opencloudb/master

删除排序的重复代码，默认改为堆排序
Merge branch 'master' of https://github.com/opencloudb/Mycat-Server
Update HeapItf.java

区分升降序
Merge pull request #27 from coderczp/patch-2

Update HeapItf.java
重构代码区分升降序

重构代码区分升降序
重构代码区分升降序

重构代码区分升降序
重构代码区分升降序

package org.opencloudb.mpp.tmp;

import java.util.Comparator;

import org.opencloudb.mpp.ColMeta;
import org.opencloudb.mpp.OrderCol;
import org.opencloudb.net.mysql.RowDataPacket;
import org.opencloudb.util.ByteUtil;
import org.opencloudb.util.CompareUtil;

/**
 * 
 * @author coderczp-2014-12-8
 */
public class RowDataCmp implements Comparator<RowDataPacket> {

    private OrderCol[] orderCols;

    public RowDataCmp(OrderCol[] orderCols) {
        this.orderCols = orderCols;
    }

    @Override
    public int compare(RowDataPacket o1, RowDataPacket o2) {
        OrderCol[] tmp = this.orderCols;
        int cmp = 0;
        int len = tmp.length;
        int type = OrderCol.COL_ORDER_TYPE_ASC;
        for (int i = 0; i < len; i++) {
            int colIndex = tmp[i].colMeta.colIndex;
            byte[] left = o1.fieldValues.get(colIndex);
            byte[] right = o2.fieldValues.get(colIndex);
            if (tmp[i].orderType == type) {
                cmp = compareObject(left, right, tmp[i]);
            } else {
                cmp = compareObject(right, left, tmp[i]);
            }
            if (cmp != 0)
                return cmp;
        }
        return cmp;
    }

    public int compareObject(byte[] left, byte[] right, OrderCol orderCol) {
        /*
         * mysql的日期也是数字字符串方式表达，因此可以跟整数等一起对待 BLOB相关类型和GEOMETRY类型不支持排序，略掉
         * ENUM和SET类型都是字符串，按字符串处理
         */
        switch (orderCol.getColMeta().getColType()) {
        case ColMeta.COL_TYPE_INT:
        case ColMeta.COL_TYPE_LONG:
        case ColMeta.COL_TYPE_SHORT:
        case ColMeta.COL_TYPE_FLOAT:
        case ColMeta.COL_TYPE_INT24:
        case ColMeta.COL_TYPE_DOUBLE:
        case ColMeta.COL_TYPE_DECIMAL:
        case ColMeta.COL_TYPE_LONGLONG:
        case ColMeta.COL_TYPE_NEWDECIMAL:
        case ColMeta.COL_TYPE_BIT:
        case ColMeta.COL_TYPE_DATE:
        case ColMeta.COL_TYPE_TIME:
        case ColMeta.COL_TYPE_YEAR:
        case ColMeta.COL_TYPE_NEWDATE:
        case ColMeta.COL_TYPE_DATETIME:
        case ColMeta.COL_TYPE_TIMSTAMP:
            return ByteUtil.compareNumberByte(left, right);
        case ColMeta.COL_TYPE_STRING:
        case ColMeta.COL_TYPE_VAR_STRING:
        case ColMeta.COL_TYPE_SET:
        case ColMeta.COL_TYPE_ENUM:
            return CompareUtil.compareString(ByteUtil.getString(left), ByteUtil.getString(right));
        }
        return 0;
    }
}
重构代码区分升降序

重构代码区分升降序
Merge remote-tracking branch 'origin/master'

Conflicts:
	src/main/java/org/opencloudb/mpp/tmp/HeapItf.java
	src/main/java/org/opencloudb/mpp/tmp/RowDataCmp.java
Merge pull request #28 from opencloudb/master

Merge remote-tracking branch 'origin/master'
1、支持childTable的insert 2、insert语句字符串解析加入一些检验异常，如不给出columnlist的提示，insert ... select的提示 3、 路由总体逻辑优化
Merge remote-tracking branch 'trunk/master'
版本号修改为5.5-mycat-1.3-alpha
Merge pull request #29 from wdw1206/master

1、支持childTable的insert 2、insert语句字符串解析加入一些检验异常，如不给出columnlist的提示，insert ....
动态加载Catlet机制完成
分离定时任务到独立线程池
跨分片Catle DEMO放到 demo.catlets包下
日志的调整等
动态类加载组件
Merge pull request #30 from opencloudb/master

动态Calet机制完成
Merge branch 'master' of https://github.com/opencloudb/Mycat-Server

Conflicts:
	src/main/java/org/opencloudb/mpp/DataMergeService.java