Class QueryPacket

java.lang.Object
org.mariadb.jdbc.message.client.QueryPacket
All Implemented Interfaces:
RedoableClientMessage, ClientMessage

public final class QueryPacket extends Object implements RedoableClientMessage
Query client packet COM_QUERY see https://mariadb.com/kb/en/com_query/
  • Field Details

    • sql

      private final String sql
    • localInfileInputStream

      private final InputStream localInfileInputStream
  • Constructor Details

    • QueryPacket

      public QueryPacket(String sql)
      Constructor
      Parameters:
      sql - sql command
    • QueryPacket

      public QueryPacket(String sql, InputStream localInfileInputStream)
      Constructor with local infile input stream
      Parameters:
      sql - sql
      localInfileInputStream - local infile input stream
  • Method Details

    • batchUpdateLength

      public int batchUpdateLength()
      Description copied from interface: ClientMessage
      Number of parameter rows, and so expected return length
      Specified by:
      batchUpdateLength in interface ClientMessage
      Returns:
      batch update length
    • encode

      public int encode(Writer writer, Context context) throws IOException
      Description copied from interface: ClientMessage
      Encode client message to socket.
      Specified by:
      encode in interface ClientMessage
      Parameters:
      writer - socket writer
      context - connection context
      Returns:
      number of client message written
      Throws:
      IOException - if socket error occur
    • isCommit

      public boolean isCommit()
      Check that command is a COMMIT command
      Returns:
      true if a commit command
    • validateLocalFileName

      public boolean validateLocalFileName(String fileName, Context context)
      Description copied from interface: ClientMessage
      Request for local file to be validated from current query.
      Specified by:
      validateLocalFileName in interface ClientMessage
      Parameters:
      fileName - server file request path
      context - current connection context
      Returns:
      true if file name correspond to demand and query is a load local infile
    • getLocalInfileInputStream

      public InputStream getLocalInfileInputStream()
      Description copied from interface: ClientMessage
      Get current local infile input stream.
      Specified by:
      getLocalInfileInputStream in interface ClientMessage
      Returns:
      default to null
    • description

      public String description()
      Description copied from interface: ClientMessage
      Message description
      Specified by:
      description in interface ClientMessage
      Returns:
      description