Package org.mariadb.jdbc.message.client

## Class PreparePacket

- java.lang.Object
- - org.mariadb.jdbc.message.client.PreparePacket

All Implemented Interfaces:
  `org.mariadb.jdbc.message.ClientMessage`

    public final class PreparePacket
    extends Object
    implements org.mariadb.jdbc.message.ClientMessage

Send a client COM_STMT_PREPARE packet see https://mariadb.com/kb/en/com_stmt_prepare/

### Constructor Summary

Constructors
`PreparePacket​(String sql)` Construct prepare packet

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `description()` Message description
`int` `encode​(Writer writer, org.mariadb.jdbc.client.Context context)` Encode client message to socket.
`org.mariadb.jdbc.client.Completion` `readPacket​(Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, Reader reader, Writer writer, org.mariadb.jdbc.client.Context context, ExceptionFactory exceptionFactory, ReentrantLock lock, boolean traceEnable, org.mariadb.jdbc.message.ClientMessage message)` default packet resultset parser

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.mariadb.jdbc.message.ClientMessage

`batchUpdateLength, binaryProtocol, canSkipMeta, getLocalInfileInputStream, validateLocalFileName`

### Constructor Detail

#### PreparePacket

    public PreparePacket​(String sql)

Construct prepare packet

Parameters:
  `sql` - sql command

### Method Detail

#### encode

    public int encode​(Writer writer,
                      org.mariadb.jdbc.client.Context context)
               throws IOException

Description copied from interface: `org.mariadb.jdbc.message.ClientMessage`
Encode client message to socket.

Specified by:
  `encode` in interface `org.mariadb.jdbc.message.ClientMessage`
Parameters:
  `writer` - socket writer
  `context` - connection context
Returns:
  number of client message written
Throws:
  `IOException` - if socket error occur

#### readPacket

    public org.mariadb.jdbc.client.Completion readPacket​(Statement stmt,
                                                         int fetchSize,
                                                         long maxRows,
                                                         int resultSetConcurrency,
                                                         int resultSetType,
                                                         boolean closeOnCompletion,
                                                         Reader reader,
                                                         Writer writer,
                                                         org.mariadb.jdbc.client.Context context,
                                                         ExceptionFactory exceptionFactory,
                                                         ReentrantLock lock,
                                                         boolean traceEnable,
                                                         org.mariadb.jdbc.message.ClientMessage message)
                                                  throws IOException,
                                                         SQLException

Description copied from interface: `org.mariadb.jdbc.message.ClientMessage`
default packet resultset parser

Specified by:
  `readPacket` in interface `org.mariadb.jdbc.message.ClientMessage`
Parameters:
  `stmt` - caller
  `fetchSize` - fetch size
  `maxRows` - maximum number of rows
  `resultSetConcurrency` - resultset concurrency
  `resultSetType` - resultset type
  `closeOnCompletion` - must close caller on result parsing end
  `reader` - packet reader
  `writer` - packet writer
  `context` - connection context
  `exceptionFactory` - connection exception factory
  `lock` - thread safe locks
  `traceEnable` - is logging trace enable
  `message` - client message
Returns:
  results
Throws:
  `IOException` - if any socket error occurs
  `SQLException` - for other kind of errors

#### description

    public String description()

Description copied from interface: `org.mariadb.jdbc.message.ClientMessage`
Message description

Specified by:
  `description` in interface `org.mariadb.jdbc.message.ClientMessage`
Returns:
  description