Search in sources :

Example 26 with MycatException

use of io.mycat.MycatException in project Mycat2 by MyCATApache.

the class MySQLPacketResolver method resolvePayloadType.

/**
 * 识别报文类型
 *
 * @param head 可能用到的信息之一,命令报文的第一个字节
 * @param isPacketFinished 报文是否接收结束
 * @param parse 是否对报文进行解析,未实现
 * @param mySQLPacket 报文本身
 * @param payloadLength Payload长度
 */
default void resolvePayloadType(int head, boolean isPacketFinished, boolean parse, MySQLPacket mySQLPacket, int payloadLength) {
    if (hasResolvePayloadType()) {
        return;
    } else {
        markedResolvePayloadType(true);
    }
    switch(getState()) {
        case QUERY_PACKET:
            {
                if (!isPacketFinished) {
                    throw new RuntimeException("unknown state!");
                }
                switch(head) {
                    case 3:
                        {
                            setState(ComQueryState.FIRST_PACKET);
                            setMySQLPayloadType(REQUEST_COM_QUERY);
                            return;
                        }
                    case 24:
                        {
                            int statementId = (int) mySQLPacket.readFixInt(4);
                            int paramId = (int) mySQLPacket.readFixInt(2);
                            setState(ComQueryState.QUERY_PACKET);
                            setMySQLPayloadType(REQUEST_SEND_LONG_DATA);
                            return;
                        }
                    case 25:
                        {
                            setState(ComQueryState.QUERY_PACKET);
                            setRequestFininshed(true);
                            setMySQLPayloadType(REQUEST_COM_STMT_CLOSE);
                            return;
                        }
                    case 22:
                        {
                            setState(ComQueryState.FIRST_PACKET);
                            setRequestFininshed(true);
                            setMySQLPayloadType(REQUEST_PREPARE);
                            return;
                        }
                    default:
                        {
                            setCurrentComQuerySQLType(head);
                            setState(ComQueryState.FIRST_PACKET);
                            setRequestFininshed(true);
                            setMySQLPayloadType(REQUEST);
                            return;
                        }
                }
            }
        case AUTH_SWITCH_PLUGIN_RESPONSE:
        case AUTH_SWITCH_OTHER_REQUEST:
        case FIRST_PACKET:
            {
                if (!isPacketFinished) {
                    throw new MycatException("unknown state!");
                }
                if (head == 0xff) {
                    setState(ComQueryState.COMMAND_END);
                    setMySQLPayloadType(FIRST_ERROR);
                } else if (head == 0x00) {
                    if (getCurrentSQLType() == 0x22 && payloadLength == 12 && getPacketId() == 1) {
                        resolvePrepareOkPacket(mySQLPacket, isPacketFinished);
                        setMySQLPayloadType(PREPARE_OK);
                        return;
                    } else {
                        setServerStatus(okPacketReadServerStatus(mySQLPacket));
                        setMySQLPayloadType(FIRST_OK);
                        if (hasMoreResult(getServerStatus())) {
                            setState(ComQueryState.FIRST_PACKET);
                        } else {
                            setState(ComQueryState.COMMAND_END);
                        }
                        return;
                    }
                } else if (head == 0xfb) {
                    setState(ComQueryState.COMMAND_END);
                    setMySQLPayloadType(LOAD_DATA_REQUEST);
                    return;
                } else if (head == 0xfe) {
                    if (isClientLogin()) {
                        setMySQLPayloadType(FIRST_EOF);
                        setState(ComQueryState.AUTH_SWITCH_PLUGIN_RESPONSE);
                    } else {
                        setServerStatus(eofPacketReadStatus(mySQLPacket));
                        setState(ComQueryState.COMMAND_END);
                        setMySQLPayloadType(FIRST_EOF);
                    }
                    return;
                } else {
                    if (isClientLogin()) {
                        setState(ComQueryState.AUTH_SWITCH_OTHER_REQUEST);
                        return;
                    }
                    int count = (int) mySQLPacket.getLenencInt(getStartPos() + MySQLPacket.getPacketHeaderSize());
                    setColumnCount(count);
                    setState(ComQueryState.COLUMN_DEFINITION);
                    setMySQLPayloadType(COLUMN_COUNT);
                }
                return;
            }
        case COLUMN_DEFINITION:
            {
                if (setColumnCount(getColumnCount() - 1) == 0) {
                    setState(!clientDeprecateEof() ? ComQueryState.COLUMN_END_EOF : ComQueryState.RESULTSET_ROW);
                }
                setMySQLPayloadType(COLUMN_DEF);
                return;
            }
        case COLUMN_END_EOF:
            {
                if (!isPacketFinished) {
                    throw new RuntimeException("unknown state!");
                }
                setServerStatus(eofPacketReadStatus(mySQLPacket));
                setState(ComQueryState.RESULTSET_ROW);
                setMySQLPayloadType(COLUMN_EOF);
                return;
            }
        case RESULTSET_ROW:
            {
                if (head == 0x00) {
                    setMySQLPayloadType(BINARY_ROW);
                } else if (head == 0xfe && payloadLength < 0xffffff) {
                    resolveResultsetRowEnd(mySQLPacket, isPacketFinished);
                } else if (head == 0xff) {
                    setState(ComQueryState.RESULTSET_ROW_ERROR);
                    setMySQLPayloadType(ROW_ERROR);
                    // 还需要切换状态到COMMAND_END
                    markedResolvePayloadType(false);
                } else {
                    // text resultset row
                    setMySQLPayloadType(TEXT_ROW);
                }
                break;
            }
        // break;
        case RESULTSET_ROW_ERROR:
            {
                // COMMAND_END结束完毕就切换到读状态
                setState(ComQueryState.COMMAND_END);
                setMySQLPayloadType(ROW_ERROR);
                break;
            }
        case PREPARE_FIELD:
        case PREPARE_FIELD_EOF:
        case PREPARE_PARAM:
        case PREPARE_PARAM_EOF:
            resolvePrepareResponse(mySQLPacket, head, isPacketFinished);
            return;
        // }
        case LOCAL_INFILE_OK_PACKET:
            if (!isPacketFinished) {
                throw new RuntimeException("unknown state!");
            }
            setServerStatus(okPacketReadServerStatus(mySQLPacket));
            setState(ComQueryState.COMMAND_END);
            return;
        case COMMAND_END:
            {
            }
            return;
        default:
            {
                if (!isPacketFinished) {
                    throw new RuntimeException("unknown state!");
                } else {
                    throw new RuntimeException("unknown state!");
                }
            }
    }
}
Also used : MycatException(io.mycat.MycatException)

Example 27 with MycatException

use of io.mycat.MycatException in project Mycat2 by MyCATApache.

the class TextResultSetHandler method onTextRow.

@Override
public void onTextRow(MySQLPacket mySQLPacket, int startPos, int endPos) throws MycatException {
    for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {
        int startIndex = mySQLPacket.packetReadStartIndex();
        if (!columnFilter(columnIndex)) {
            mySQLPacket.skipLenencBytes(startIndex);
            continue;
        }
        ColumnDefPacket columnDef = currentColumnDefList[columnIndex];
        int columnType = columnDef.getColumnType();
        if (isNull(mySQLPacket, startIndex)) {
            mySQLPacket.packetReadStartIndex(startIndex + 1);
            switch(columnType) {
                default:
                    {
                        throw new MycatException("unknown field message:{}", (columnType));
                    }
                case FIELD_TYPE_DECIMAL:
                    {
                        collector.collectNullDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff);
                        break;
                    }
                case FIELD_TYPE_TINY:
                    {
                        collector.collectNullTiny(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_SHORT:
                    {
                        collector.collectNullShort(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONG:
                    {
                        collector.collectNullLong(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_FLOAT:
                    {
                        collector.collectNullFloat(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DOUBLE:
                    {
                        collector.collectNullDouble(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NULL:
                    {
                        collector.collectNull(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TIMESTAMP:
                    {
                        collector.collectNullTimestamp(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONGLONG:
                    {
                        collector.collectNullLongLong(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_INT24:
                    {
                        collector.collectNullInt24(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DATE:
                    {
                        collector.collectNullDate(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TIME:
                    {
                        collector.collectNullTime(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DATETIME:
                    {
                        collector.collectNullDatetime(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_YEAR:
                    {
                        collector.collectNullYear(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NEWDATE:
                    {
                        collector.collectNullNewDate(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_VARCHAR:
                    {
                        collector.collectNullVarChar(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_BIT:
                    {
                        collector.collectNullBit(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NEW_DECIMAL:
                    {
                        collector.collectNullNewDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff);
                        break;
                    }
                case FIELD_TYPE_ENUM:
                    {
                        collector.collectNullEnum(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_SET:
                    {
                        collector.collectNullSet(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TINY_BLOB:
                    {
                        collector.collectNullTinyBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_MEDIUM_BLOB:
                    {
                        collector.collectNullMediumBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONG_BLOB:
                    {
                        collector.collectNullLongBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_BLOB:
                    {
                        collector.collectNullBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_VAR_STRING:
                    {
                        collector.collectNullVarString(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_STRING:
                    {
                        collector.collectNullTinyString(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_GEOMETRY:
                    {
                        collector.collectNullGeometry(columnIndex, columnDef);
                        break;
                    }
            }
            continue;
        }
        switch(columnType) {
            default:
                {
                    throw new MycatException("unknown field message:{}", (columnType));
                }
            case FIELD_TYPE_DECIMAL:
                {
                    collector.collectDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TINY:
                {
                    collector.collectTiny(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_SHORT:
                {
                    collector.collectShort(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONG:
                {
                    collector.collectLong(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_FLOAT:
                {
                    collector.collectFloat(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DOUBLE:
                {
                    collector.collectDouble(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NULL:
                {
                    collector.collectNull(columnIndex, columnDef);
                    break;
                }
            case FIELD_TYPE_TIMESTAMP:
                {
                    collector.collectTimestamp(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONGLONG:
                {
                    collector.collectLongLong(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_INT24:
                {
                    collector.collectInt24(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DATE:
                {
                    collector.collectDate(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TIME:
                {
                    collector.collectTime(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DATETIME:
                {
                    collector.collectDatetime(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_YEAR:
                {
                    collector.collectYear(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NEWDATE:
                {
                    collector.collectNewDate(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_VARCHAR:
                {
                    collector.collectVarChar(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_BIT:
                {
                    collector.collectBit(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NEW_DECIMAL:
                {
                    collector.collectNewDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_ENUM:
                {
                    collector.collectEnum(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_SET:
                {
                    collector.collectSet(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TINY_BLOB:
                {
                    collector.collectTinyBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_MEDIUM_BLOB:
                {
                    collector.collectMediumBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONG_BLOB:
                {
                    collector.collectLongBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_BLOB:
                {
                    collector.collectBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_VAR_STRING:
                {
                    collector.collectVarString(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_STRING:
                {
                    collector.collectTinyString(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_GEOMETRY:
                {
                    collector.collectGeometry(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
        }
        int mayBeErrorStartIndex = mySQLPacket.packetReadStartIndex();
        if (mySQLPacket.skipLenencBytes(startIndex) == mayBeErrorStartIndex) {
        }
    }
    collector.onRowEnd();
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) MycatException(io.mycat.MycatException)

Example 28 with MycatException

use of io.mycat.MycatException in project Mycat2 by MyCATApache.

the class MySQLClientSession method writeCurrentProxyPacket.

/**
 * newCurrentProxyPacket的配套方法,把该方法构造的报文写入通道
 */
public void writeCurrentProxyPacket(MySQLPacket ogrin, int packetId) throws IOException {
    ProxyBufferImpl mySQLPacket1 = (ProxyBufferImpl) ogrin;
    ByteBuffer buffer = mySQLPacket1.currentByteBuffer();
    int packetEndPos = buffer.position();
    int payloadLen = buffer.position() - 4;
    if (payloadLen < MySQLPacketSplitter.MAX_PACKET_SIZE) {
        ogrin.putFixInt(0, 3, payloadLen);
        ogrin.putByte(3, (byte) packetId);
        ProxyBuffer packet1 = (ProxyBuffer) ogrin;
        packet1.channelWriteStartIndex(0);
        packet1.channelWriteEndIndex(packetEndPos);
        writeToChannel();
    } else {
        throw new MycatException("unsupport max packet {}", MySQLPacketSplitter.MAX_PACKET_SIZE);
    }
}
Also used : ProxyBufferImpl(io.mycat.proxy.buffer.ProxyBufferImpl) MycatException(io.mycat.MycatException) ProxyBuffer(io.mycat.beans.mysql.packet.ProxyBuffer) ByteBuffer(java.nio.ByteBuffer)

Example 29 with MycatException

use of io.mycat.MycatException in project Mycat2 by MyCATApache.

the class NIOAcceptor method processConnectKey.

/**
 * 仅后台维护的主动创建的连接使用
 */
@SuppressWarnings("unchecked")
protected void processConnectKey(SelectionKey curKey) throws IOException {
    // only from cluster server socket
    SocketChannel curChannel = (SocketChannel) curKey.channel();
    Object obj = curKey.attachment();
    try {
        if (curChannel.finishConnect()) {
            throw new MycatException("unsupport!");
        }
    } catch (ConnectException ex) {
        LOGGER.warn("Connect failed:{}  message:{}", curChannel, ex);
    }
}
Also used : SocketChannel(java.nio.channels.SocketChannel) ServerSocketChannel(java.nio.channels.ServerSocketChannel) MycatException(io.mycat.MycatException) ConnectException(java.net.ConnectException)

Example 30 with MycatException

use of io.mycat.MycatException in project Mycat2 by MyCATApache.

the class BinaryResultSetHandler method onBinaryRow.

@Override
public void onBinaryRow(MySQLPacket mySQLPacket, int startPos, int endPos) {
    collector.onRowStart();
    int nullBitMapStartPos = startPos + 4 + 1;
    int nullBitMapEndPos = nullBitMapStartPos + binaryNullBitMapLength;
    mySQLPacket.packetReadStartIndex(nullBitMapEndPos);
    for (int columnIndex = 0; columnIndex < currentColumnDefList.length; columnIndex++) {
        ColumnDefPacket columnDef = currentColumnDefList[columnIndex];
        int i = nullBitMapStartPos + (columnIndex + 2) / 8;
        byte aByte = mySQLPacket.getByte(i);
        boolean isNull = ((aByte & (1 << (columnIndex & 7))) != 0);
        int startIndex = mySQLPacket.packetReadStartIndex();
        int columnType = columnDef.getColumnType();
        if (isNull) {
            switch(columnType) {
                default:
                    {
                        throw new MycatException("unknown field message:{}", columnType);
                    }
                case FIELD_TYPE_DECIMAL:
                    {
                        collector.collectNullDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff);
                        break;
                    }
                case FIELD_TYPE_TINY:
                    {
                        collector.collectNullTiny(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_SHORT:
                    {
                        collector.collectNullShort(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONG:
                    {
                        collector.collectNullLong(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_FLOAT:
                    {
                        collector.collectNullFloat(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DOUBLE:
                    {
                        collector.collectNullDouble(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NULL:
                    {
                        collector.collectNull(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TIMESTAMP:
                    {
                        collector.collectNullTimestamp(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONGLONG:
                    {
                        collector.collectNullLongLong(columnIndex, columnDef);
                        break;
                    }
                case MySQLFieldsType.FIELD_TYPE_INT24:
                    {
                        collector.collectNullInt24(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DATE:
                    {
                        collector.collectNullDate(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TIME:
                    {
                        collector.collectNullTime(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_DATETIME:
                    {
                        collector.collectNullDatetime(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_YEAR:
                    {
                        collector.collectNullYear(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NEWDATE:
                    {
                        collector.collectNullNewDate(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_VARCHAR:
                    {
                        collector.collectNullVarChar(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_BIT:
                    {
                        collector.collectNullBit(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_NEW_DECIMAL:
                    {
                        collector.collectNullNewDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff);
                        break;
                    }
                case FIELD_TYPE_ENUM:
                    {
                        collector.collectNullEnum(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_SET:
                    {
                        collector.collectNullSet(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_TINY_BLOB:
                    {
                        collector.collectNullTinyBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_MEDIUM_BLOB:
                    {
                        collector.collectNullMediumBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_LONG_BLOB:
                    {
                        collector.collectNullLongBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_BLOB:
                    {
                        collector.collectNullBlob(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_VAR_STRING:
                    {
                        collector.collectNullVarString(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_STRING:
                    {
                        collector.collectNullTinyString(columnIndex, columnDef);
                        break;
                    }
                case FIELD_TYPE_GEOMETRY:
                    {
                        collector.collectNullGeometry(columnIndex, columnDef);
                        break;
                    }
            }
            continue;
        }
        /**
         * 二进制格式,详细看协议,startIndex 是
         * 字符串类型,长度的开始位置;
         * 值类型,不带长度
         */
        switch(columnType) {
            default:
                {
                    throw new MycatException("unknown field message {}", (columnType));
                }
            case FIELD_TYPE_DECIMAL:
                {
                    collector.collectDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TINY:
                {
                    collector.collectTiny(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_SHORT:
                {
                    collector.collectShort(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONG:
                {
                    collector.collectLong(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_FLOAT:
                {
                    collector.collectFloat(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DOUBLE:
                {
                    collector.collectDouble(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NULL:
                {
                    collector.collectNull(columnIndex, columnDef);
                    break;
                }
            case FIELD_TYPE_TIMESTAMP:
                {
                    collector.collectTimestamp(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONGLONG:
                {
                    collector.collectLongLong(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_INT24:
                {
                    collector.collectInt24(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DATE:
                {
                    collector.collectDate(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TIME:
                {
                    collector.collectTime(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_DATETIME:
                {
                    collector.collectDatetime(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_YEAR:
                {
                    collector.collectYear(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NEWDATE:
                {
                    collector.collectNewDate(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_VARCHAR:
                {
                    collector.collectVarChar(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_BIT:
                {
                    collector.collectBit(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_NEW_DECIMAL:
                {
                    collector.collectNewDecimal(columnIndex, columnDef, columnDef.getColumnDecimals() & 0xff, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_ENUM:
                {
                    collector.collectEnum(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_SET:
                {
                    collector.collectSet(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_TINY_BLOB:
                {
                    collector.collectTinyBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_MEDIUM_BLOB:
                {
                    collector.collectMediumBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_LONG_BLOB:
                {
                    collector.collectLongBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_BLOB:
                {
                    collector.collectBlob(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_VAR_STRING:
                {
                    collector.collectVarString(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_STRING:
                {
                    collector.collectTinyString(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
            case FIELD_TYPE_GEOMETRY:
                {
                    collector.collectGeometry(columnIndex, columnDef, mySQLPacket, startIndex);
                    break;
                }
        }
    }
    collector.onRowEnd();
}
Also used : ColumnDefPacket(io.mycat.beans.mysql.packet.ColumnDefPacket) MycatException(io.mycat.MycatException)

Aggregations

MycatException (io.mycat.MycatException)31 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)3 SQLName (com.alibaba.druid.sql.ast.SQLName)3 SQLIdentifierExpr (com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr)3 MySQLClientSession (io.mycat.proxy.session.MySQLClientSession)3 SQLException (java.sql.SQLException)3 CalciteSqlBasicCall (com.alibaba.druid.support.calcite.CalciteSqlBasicCall)2 ColumnDefPacket (io.mycat.beans.mysql.packet.ColumnDefPacket)2 DatasourceConfig (io.mycat.config.DatasourceConfig)2 ProxyBufferImpl (io.mycat.proxy.buffer.ProxyBufferImpl)2 ReactorEnvThread (io.mycat.proxy.reactor.ReactorEnvThread)2 Future (io.vertx.core.Future)2 PromiseInternal (io.vertx.core.impl.future.PromiseInternal)2 Statement (java.sql.Statement)2 DateString (org.apache.calcite.util.DateString)2 TimeString (org.apache.calcite.util.TimeString)2 TimestampString (org.apache.calcite.util.TimestampString)2 SQLBooleanExpr (com.alibaba.druid.sql.ast.expr.SQLBooleanExpr)1 SQLExprTableSource (com.alibaba.druid.sql.ast.statement.SQLExprTableSource)1 SQLShowTablesStatement (com.alibaba.druid.sql.ast.statement.SQLShowTablesStatement)1