Package com.google.code.or.io.util

Examples of com.google.code.or.io.util.XSerializer


 
  /**
   *
   */
  public byte[] getPacketBody() throws IOException {
    final XSerializer ps = new XSerializer();
    ps.writeInt(this.command, 1);
    ps.writeFixedLengthString(this.databaseName);
    return ps.toByteArray();
  }
View Full Code Here


 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(256);
    s.writeLengthCodedString(this.catalog);
    s.writeLengthCodedString(this.db);
    s.writeLengthCodedString(this.table);
    s.writeLengthCodedString(this.orginalTable);
    s.writeLengthCodedString(this.column);
    s.writeLengthCodedString(this.originalColumn);
    s.writeInt(this.fixed12, 1);
    s.writeInt(this.charset, 2);
    s.writeLong(this.fieldLength, 4);
    s.writeInt(this.fieldType, 1);
    s.writeInt(this.fieldOptions, 2);
    s.writeInt(this.decimalPrecision, 1);
    s.writeInt(this.reserved, 2);
    if(this.defaultValue != null) s.writeLengthCodedString(this.defaultValue);
    return s.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() throws IOException {
    final XSerializer ps = new XSerializer();
    ps.writeInt(this.command, 1);
    ps.writeFixedLengthString(this.sql);
    return ps.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() throws IOException {
    final XSerializer ps = new XSerializer();
    ps.writeInt(this.command, 1);
    ps.writeLong(this.binlogPosition, 4);
    ps.writeInt(this.binlogFlag, 2);
    ps.writeLong(this.serverId, 4);
    ps.writeFixedLengthString(this.binlogFileName);
    return ps.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(128);
    s.writeInt(this.protocolVersion, 1);
    s.writeNullTerminatedString(this.serverVersion);
    s.writeLong(this.threadId, 4);
    s.writeNullTerminatedString(this.scramble1);
    s.writeInt(this.serverCapabilities, 2);
    s.writeInt(this.serverCollation, 1);
    s.writeInt(this.serverStatus, 2);
    s.writeInt(0, 13);
    s.writeNullTerminatedString(this.scramble2);
    s.writeNullTerminatedString(this.pluginProvidedData);
    return s.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(32);
    s.writeInt(this.packetMarker, 1);
    s.writeInt(this.warningCount, 2);
    s.writeInt(this.serverStatus, 2);
    return s.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(1024);
    for(StringColumn column : this.columns) {
      s.writeLengthCodedString(column);
    }
    return s.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(64);
    s.writeInt(this.packetMarker, 1);
    s.writeUnsignedLong(this.affectedRows);
    s.writeUnsignedLong(this.insertId);
    s.writeInt(this.serverStatus, 2);
    s.writeInt(this.warningCount, 2);
    if(this.message != null) s.writeFixedLengthString(this.message);
    return s.toByteArray();
  }
View Full Code Here

 
  /**
   *
   */
  public byte[] getPacketBody() {
    final XSerializer s = new XSerializer(64);
    s.writeInt(this.packetMarker, 1);
    s.writeInt(this.errorCode, 2);
    s.writeFixedLengthString(this.slash);
    s.writeFixedLengthString(this.sqlState);
    s.writeFixedLengthString(this.errorMessage);
    return s.toByteArray();
  }
View Full Code Here

    //
    final TransportContext ctx = transport.getContext();
    LOGGER.info("start to login, user: {}, host: {}, port: {}", new Object[]{this.user, ctx.getServerHost(), ctx.getServerPort()});
   
    //
    final XSerializer s = new XSerializer(64);
    s.writeInt(buildClientCapabilities(), 4);
    s.writeInt(this.maximumPacketLength, 4);
    s.writeInt(this.clientCollation > 0 ? this.clientCollation : ctx.getServerCollation(), 1);
    s.writeBytes((byte)0, 23); // Fixed, all 0
    s.writeNullTerminatedString(StringColumn.valueOf(this.user.getBytes(this.encoding)));
    s.writeInt(20, 1); // the length of the SHA1 encrypted password
    s.writeBytes(MySQLUtils.password41OrLater(this.password.getBytes(this.encoding), ctx.getScramble().getBytes(this.encoding)));
    if(this.initialSchema != null) s.writeNullTerminatedString(StringColumn.valueOf(this.initialSchema.getBytes(this.encoding)));
   
    //
    final RawPacket request = new RawPacket();
    request.setSequence(1);
    request.setPacketBody(s.toByteArray());
    request.setLength(request.getPacketBody().length);
    transport.getOutputStream().writePacket(request);
    transport.getOutputStream().flush();
   
    //
View Full Code Here

TOP

Related Classes of com.google.code.or.io.util.XSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.