Package org.mariadb.jdbc.message.client
Class PrepareExecutePacket
- java.lang.Object
-
- org.mariadb.jdbc.message.client.PrepareExecutePacket
-
- All Implemented Interfaces:
RedoableClientMessage
,RedoableWithPrepareClientMessage
,ClientMessage
public final class PrepareExecutePacket extends java.lang.Object implements RedoableWithPrepareClientMessage
Send a client COM_STMT_PREPARE + COM_STMT_EXECUTE packets see- See Also:
- Prepare packet
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.InputStream
localInfileInputStream
private Parameters
parameters
private ServerPreparedStatement
prep
private PrepareResultPacket
prepareResult
private java.lang.String
sql
-
Constructor Summary
Constructors Constructor Description PrepareExecutePacket(java.lang.String sql, Parameters parameters, ServerPreparedStatement prep, java.io.InputStream localInfileInputStream)
Construct prepare packet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
batchUpdateLength()
Number of parameter rows, and so expected return lengthboolean
binaryProtocol()
Are return value encoded in binary protocolboolean
canSkipMeta()
Can skip metadatajava.lang.String
description()
Message descriptionint
encode(Writer writer, Context context, Prepare newPrepareResult)
encoder method in case of failover, passing new prepared objectvoid
ensureReplayable(Context context)
Ensure that command can be replayedjava.lang.String
getCommand()
sql command valuejava.io.InputStream
getLocalInfileInputStream()
Get current local infile input stream.ServerPreparedStatement
prep()
Server prepare statement callerCompletion
readPacket(Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, Reader reader, Writer writer, Context context, ExceptionFactory exceptionFactory, ClosableLock lock, boolean traceEnable, ClientMessage message, java.util.function.Consumer<java.lang.String> redirectFct)
default packet resultset parservoid
saveParameters()
Save parameters of command that can be re-executedvoid
setPrepareResult(PrepareResultPacket prepareResult)
Set prepare result, if pipelining prepareboolean
validateLocalFileName(java.lang.String fileName, Context context)
Request for local file to be validated from current query.-
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
mightBeBulkResult
-
Methods inherited from interface org.mariadb.jdbc.message.client.RedoableWithPrepareClientMessage
encode, reEncode, rePrepare
-
-
-
-
Field Detail
-
sql
private final java.lang.String sql
-
prep
private final ServerPreparedStatement prep
-
localInfileInputStream
private final java.io.InputStream localInfileInputStream
-
prepareResult
private PrepareResultPacket prepareResult
-
parameters
private Parameters parameters
-
-
Constructor Detail
-
PrepareExecutePacket
public PrepareExecutePacket(java.lang.String sql, Parameters parameters, ServerPreparedStatement prep, java.io.InputStream localInfileInputStream)
Construct prepare packet- Parameters:
sql
- sqlparameters
- parameterprep
- preparelocalInfileInputStream
- local infile input stream
-
-
Method Detail
-
encode
public int encode(Writer writer, Context context, Prepare newPrepareResult) throws java.io.IOException, java.sql.SQLException
Description copied from interface:RedoableWithPrepareClientMessage
encoder method in case of failover, passing new prepared object- Specified by:
encode
in interfaceRedoableClientMessage
- Specified by:
encode
in interfaceRedoableWithPrepareClientMessage
- Parameters:
writer
- socket writercontext
- connection contextnewPrepareResult
- new prepare result- Returns:
- number of command sent
- Throws:
java.io.IOException
- if a socket exception occursjava.sql.SQLException
- for any other kind of error
-
readPacket
public Completion readPacket(Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, Reader reader, Writer writer, Context context, ExceptionFactory exceptionFactory, ClosableLock lock, boolean traceEnable, ClientMessage message, java.util.function.Consumer<java.lang.String> redirectFct) throws java.io.IOException, java.sql.SQLException
Description copied from interface:ClientMessage
default packet resultset parser- Specified by:
readPacket
in interfaceClientMessage
- Parameters:
stmt
- callerfetchSize
- fetch sizemaxRows
- maximum number of rowsresultSetConcurrency
- resultset concurrencyresultSetType
- resultset typecloseOnCompletion
- must close caller on result parsing endreader
- packet readerwriter
- packet writercontext
- connection contextexceptionFactory
- connection exception factorylock
- thread safe lockstraceEnable
- is logging trace enablemessage
- client messageredirectFct
- redirect consumer- Returns:
- results
- Throws:
java.io.IOException
- if any socket error occursjava.sql.SQLException
- for other kind of errors
-
saveParameters
public void saveParameters()
Description copied from interface:RedoableClientMessage
Save parameters of command that can be re-executed- Specified by:
saveParameters
in interfaceRedoableClientMessage
-
ensureReplayable
public void ensureReplayable(Context context) throws java.io.IOException, java.sql.SQLException
Description copied from interface:RedoableClientMessage
Ensure that command can be replayed- Specified by:
ensureReplayable
in interfaceRedoableClientMessage
- Parameters:
context
- connection context- Throws:
java.io.IOException
- If socket error occursjava.sql.SQLException
- for other type of issue
-
canSkipMeta
public boolean canSkipMeta()
Description copied from interface:ClientMessage
Can skip metadata- Specified by:
canSkipMeta
in interfaceClientMessage
- Returns:
- can skip metadata
-
description
public java.lang.String description()
Description copied from interface:ClientMessage
Message description- Specified by:
description
in interfaceClientMessage
- Returns:
- description
-
batchUpdateLength
public int batchUpdateLength()
Description copied from interface:ClientMessage
Number of parameter rows, and so expected return length- Specified by:
batchUpdateLength
in interfaceClientMessage
- Returns:
- batch update length
-
getCommand
public java.lang.String getCommand()
Description copied from interface:RedoableWithPrepareClientMessage
sql command value- Specified by:
getCommand
in interfaceRedoableWithPrepareClientMessage
- Returns:
- sql command
-
getLocalInfileInputStream
public java.io.InputStream getLocalInfileInputStream()
Description copied from interface:ClientMessage
Get current local infile input stream.- Specified by:
getLocalInfileInputStream
in interfaceClientMessage
- Returns:
- default to null
-
prep
public ServerPreparedStatement prep()
Description copied from interface:RedoableWithPrepareClientMessage
Server prepare statement caller- Specified by:
prep
in interfaceRedoableWithPrepareClientMessage
- Returns:
- caller
-
binaryProtocol
public boolean binaryProtocol()
Description copied from interface:ClientMessage
Are return value encoded in binary protocol- Specified by:
binaryProtocol
in interfaceClientMessage
- Returns:
- use binary protocol
-
validateLocalFileName
public boolean validateLocalFileName(java.lang.String fileName, Context context)
Description copied from interface:ClientMessage
Request for local file to be validated from current query.- Specified by:
validateLocalFileName
in interfaceClientMessage
- Parameters:
fileName
- server file request pathcontext
- current connection context- Returns:
- true if file name correspond to demand and query is a load local infile
-
setPrepareResult
public void setPrepareResult(PrepareResultPacket prepareResult)
Description copied from interface:RedoableWithPrepareClientMessage
Set prepare result, if pipelining prepare- Specified by:
setPrepareResult
in interfaceRedoableWithPrepareClientMessage
- Parameters:
prepareResult
- prepare results
-
-