Search in sources :

Example 31 with MySQLPayloadWriter

use of io.mycat.beans.mysql.MySQLPayloadWriter in project Mycat2 by MyCATApache.

the class BinaryResultSetResponse method convertString.

public static byte[] convertString(Object object) {
    byte[] bytes;
    if (object instanceof byte[]) {
        bytes = (byte[]) object;
    } else {
        bytes = object.toString().getBytes();
    }
    MySQLPayloadWriter mySQLPayloadWriter = new MySQLPayloadWriter(bytes.length);
    mySQLPayloadWriter.writeLenencBytes(bytes);
    return mySQLPayloadWriter.toByteArray();
}
Also used : MySQLPayloadWriter(io.mycat.beans.mysql.MySQLPayloadWriter)

Aggregations

MySQLPayloadWriter (io.mycat.beans.mysql.MySQLPayloadWriter)31 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 MycatMySQLRowMetaData (io.mycat.beans.mycat.MycatMySQLRowMetaData)2 AuthPacket (io.mycat.beans.mysql.packet.AuthPacket)2 AuthSwitchRequestPacket (io.mycat.beans.mysql.packet.AuthSwitchRequestPacket)2 Authenticator (io.mycat.Authenticator)1 MycatUser (io.mycat.MycatUser)1 HandshakePacket (io.mycat.beans.mysql.packet.HandshakePacket)1 MySQLPacket (io.mycat.beans.mysql.packet.MySQLPacket)1 MySQLServerCapabilityFlags (io.mycat.config.MySQLServerCapabilityFlags)1 UserConfig (io.mycat.config.UserConfig)1 Buffer (io.vertx.core.buffer.Buffer)1 SocketAddress (java.net.SocketAddress)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1