Search in sources :

Example 46 with RowDataPacket

use of io.mycat.net.mysql.RowDataPacket in project Mycat_plus by coderczp.

the class ResultSetUtil method parseRowData.

public static RowDataPacket parseRowData(byte[] row, List<byte[]> fieldValues) {
    RowDataPacket rowDataPkg = new RowDataPacket(fieldValues.size());
    rowDataPkg.read(row);
    return rowDataPkg;
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket)

Example 47 with RowDataPacket

use of io.mycat.net.mysql.RowDataPacket in project Mycat_plus by coderczp.

the class ResultSetUtil method getColumnVal.

public static byte[] getColumnVal(byte[] row, List<byte[]> fieldValues, int columnIndex) {
    RowDataPacket rowDataPkg = new RowDataPacket(fieldValues.size());
    rowDataPkg.read(row);
    byte[] columnData = rowDataPkg.fieldValues.get(columnIndex);
    return columnData;
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket)

Example 48 with RowDataPacket

use of io.mycat.net.mysql.RowDataPacket in project Mycat_plus by coderczp.

the class RowDataPacketGrouper method filterHaving.

private void filterHaving() {
    if (havingCols.getColMeta() == null || result == null) {
        return;
    }
    Iterator<RowDataPacket> it = result.iterator();
    byte[] right = havingCols.getRight().getBytes(StandardCharsets.UTF_8);
    int index = havingCols.getColMeta().getColIndex();
    // Added by winbill. 20160312.
    int colType = havingCols.getColMeta().getColType();
    while (it.hasNext()) {
        RowDataPacket rowDataPacket = it.next();
        switch(havingCols.getOperator()) {
            case "=":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (eq(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
            case ">":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (gt(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
            case "<":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (lt(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
            case ">=":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (gt(rowDataPacket.fieldValues.get(index), right, colType) && eq(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
            case "<=":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (lt(rowDataPacket.fieldValues.get(index), right, colType) && eq(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
            case "!=":
                /* Add parameter of colType, Modified by winbill. 20160312. */
                if (neq(rowDataPacket.fieldValues.get(index), right, colType)) {
                    it.remove();
                }
                break;
        }
    }
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket)

Example 49 with RowDataPacket

use of io.mycat.net.mysql.RowDataPacket in project Mycat_plus by coderczp.

the class MaxHeap method swap.

private void swap(int i, int j) {
    RowDataPacket tmp = data.get(i);
    RowDataPacket elementAt = data.get(j);
    data.set(i, elementAt);
    data.set(j, tmp);
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket)

Example 50 with RowDataPacket

use of io.mycat.net.mysql.RowDataPacket in project Mycat_plus by coderczp.

the class MinHeap method swap.

private void swap(int i, int j) {
    RowDataPacket tmp = data.get(i);
    RowDataPacket elementAt = data.get(j);
    data.set(i, elementAt);
    data.set(j, tmp);
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket)

Aggregations

RowDataPacket (io.mycat.net.mysql.RowDataPacket)269 FieldPacket (io.mycat.net.mysql.FieldPacket)143 ByteBuffer (java.nio.ByteBuffer)140 EOFPacket (io.mycat.net.mysql.EOFPacket)137 MycatConfig (io.mycat.config.MycatConfig)20 LinkedList (java.util.LinkedList)16 PhysicalDatasource (io.mycat.backend.datasource.PhysicalDatasource)14 NIOProcessor (io.mycat.net.NIOProcessor)14 SchemaConfig (io.mycat.config.model.SchemaConfig)13 ResultSetHeaderPacket (io.mycat.net.mysql.ResultSetHeaderPacket)13 PhysicalDBPool (io.mycat.backend.datasource.PhysicalDBPool)12 UserStat (io.mycat.statistic.stat.UserStat)12 IOException (java.io.IOException)12 Map (java.util.Map)12 DBHeartbeat (io.mycat.backend.heartbeat.DBHeartbeat)10 ServerConnection (io.mycat.server.ServerConnection)10 BinaryRowDataPacket (io.mycat.net.mysql.BinaryRowDataPacket)8 File (java.io.File)8 DataSourceSyncRecorder (io.mycat.statistic.DataSourceSyncRecorder)6 BufferedReader (java.io.BufferedReader)6