Package com.mysql.cj
Class AbstractQueryBindings<T extends BindValue>
java.lang.Object
com.mysql.cj.AbstractQueryBindings<T>
- All Implemented Interfaces:
QueryBindings<T>
- Direct Known Subclasses:
ClientPreparedQueryBindings
,ServerPreparedQueryBindings
public abstract class AbstractQueryBindings<T extends BindValue> extends java.lang.Object implements QueryBindings<T>
-
Field Summary
Fields Modifier and Type Field Description protected T[]
bindValues
Bind values for individual fieldsprotected java.lang.String
charEncoding
protected ColumnDefinition
columnDefinition
protected static java.time.LocalDate
DEFAULT_DATE
protected static java.time.LocalTime
DEFAULT_TIME
protected static byte[]
HEX_DIGITS
protected boolean
isLoadDataQuery
Is this query a LOAD DATA query?protected int
numberOfExecutions
protected RuntimeProperty<java.lang.Boolean>
preserveInstants
protected RuntimeProperty<java.lang.Boolean>
sendFractionalSeconds
protected RuntimeProperty<java.lang.Boolean>
sendFractionalSecondsForTime
protected Session
session
protected RuntimeProperty<java.lang.Boolean>
useStreamLengthsInPrepStmts
-
Constructor Summary
Constructors Constructor Description AbstractQueryBindings(int parameterCount, Session sess)
-
Method Summary
Modifier and Type Method Description void
checkAllParametersSet()
abstract void
checkParameterSet(int columnIndex)
boolean
clearBindValues()
abstract AbstractQueryBindings<T>
clone()
T[]
getBindValues()
byte[]
getBytesRepresentation(int parameterIndex)
int
getNumberOfExecutions()
byte[]
getOrigBytes(int parameterIndex)
void
hexEscapeBlock(byte[] buf, NativePacketPayload packet, int size)
Used to escape binary data with hex for mb charsetsprotected abstract void
initBindValues(int parameterCount)
boolean
isLoadDataQuery()
boolean
isNull(int parameterIndex)
void
setBindValues(T[] bindValues)
void
setColumnDefinition(ColumnDefinition colDef)
void
setLoadDataQuery(boolean isLoadDataQuery)
void
setNumberOfExecutions(int numberOfExecutions)
void
setObject(int parameterIndex, java.lang.Object parameterObj)
void
setObject(int parameterIndex, java.lang.Object parameterObj, MysqlType targetMysqlType)
void
setObject(int parameterIndex, java.lang.Object parameterObj, MysqlType targetMysqlType, int scaleOrLength)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.void
setOrigValue(int paramIndex, byte[] val)
protected void
setSerializableObject(int parameterIndex, java.lang.Object parameterObj)
Sets the value for the placeholder as a serialized Java object (used by various forms of setObject()void
setTimestamp(int parameterIndex, java.sql.Timestamp x, MysqlType targetMysqlType)
void
setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar targetCalendar, int fractionalLength, MysqlType targetMysqlType)
void
setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal, MysqlType targetMysqlType)
void
setValue(int paramIndex, byte[] val, MysqlType type)
void
setValue(int paramIndex, java.lang.String val, MysqlType type)
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mysql.cj.QueryBindings
bindTimestamp, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigInteger, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setBytes, setBytesNoEscape, setBytesNoEscapeNoQuotes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLocalDate, setLocalDateTime, setLocalTime, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setShort, setString, setTime, setTime
-
Field Details
-
HEX_DIGITS
protected static final byte[] HEX_DIGITS -
DEFAULT_DATE
protected static final java.time.LocalDate DEFAULT_DATE -
DEFAULT_TIME
protected static final java.time.LocalTime DEFAULT_TIME -
session
-
bindValues
Bind values for individual fields -
charEncoding
protected java.lang.String charEncoding -
numberOfExecutions
protected int numberOfExecutions -
useStreamLengthsInPrepStmts
-
preserveInstants
-
sendFractionalSeconds
-
sendFractionalSecondsForTime
-
isLoadDataQuery
protected boolean isLoadDataQueryIs this query a LOAD DATA query? -
columnDefinition
-
-
Constructor Details
-
Method Details
-
initBindValues
protected abstract void initBindValues(int parameterCount) -
clone
- Specified by:
clone
in interfaceQueryBindings<T extends BindValue>
- Overrides:
clone
in classjava.lang.Object
-
setColumnDefinition
- Specified by:
setColumnDefinition
in interfaceQueryBindings<T extends BindValue>
-
isLoadDataQuery
public boolean isLoadDataQuery()- Specified by:
isLoadDataQuery
in interfaceQueryBindings<T extends BindValue>
-
setLoadDataQuery
public void setLoadDataQuery(boolean isLoadDataQuery)- Specified by:
setLoadDataQuery
in interfaceQueryBindings<T extends BindValue>
-
getBindValues
- Specified by:
getBindValues
in interfaceQueryBindings<T extends BindValue>
-
setBindValues
- Specified by:
setBindValues
in interfaceQueryBindings<T extends BindValue>
-
clearBindValues
public boolean clearBindValues()- Specified by:
clearBindValues
in interfaceQueryBindings<T extends BindValue>
- Returns:
- true if bind values had long data
-
checkParameterSet
public abstract void checkParameterSet(int columnIndex)- Specified by:
checkParameterSet
in interfaceQueryBindings<T extends BindValue>
-
checkAllParametersSet
public void checkAllParametersSet()- Specified by:
checkAllParametersSet
in interfaceQueryBindings<T extends BindValue>
-
getNumberOfExecutions
public int getNumberOfExecutions()- Specified by:
getNumberOfExecutions
in interfaceQueryBindings<T extends BindValue>
-
setNumberOfExecutions
public void setNumberOfExecutions(int numberOfExecutions)- Specified by:
setNumberOfExecutions
in interfaceQueryBindings<T extends BindValue>
-
setValue
- Specified by:
setValue
in interfaceQueryBindings<T extends BindValue>
-
setOrigValue
public final void setOrigValue(int paramIndex, byte[] val) -
getOrigBytes
public byte[] getOrigBytes(int parameterIndex)- Specified by:
getOrigBytes
in interfaceQueryBindings<T extends BindValue>
-
setValue
- Specified by:
setValue
in interfaceQueryBindings<T extends BindValue>
-
hexEscapeBlock
Used to escape binary data with hex for mb charsets- Parameters:
buf
- source bytespacket
- write to this packetsize
- number of bytes to read
-
setTimestamp
- Specified by:
setTimestamp
in interfaceQueryBindings<T extends BindValue>
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal, MysqlType targetMysqlType)- Specified by:
setTimestamp
in interfaceQueryBindings<T extends BindValue>
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar targetCalendar, int fractionalLength, MysqlType targetMysqlType)- Specified by:
setTimestamp
in interfaceQueryBindings<T extends BindValue>
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj)- Specified by:
setObject
in interfaceQueryBindings<T extends BindValue>
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj, MysqlType targetMysqlType)- Specified by:
setObject
in interfaceQueryBindings<T extends BindValue>
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj, MysqlType targetMysqlType, int scaleOrLength)Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.The given Java object will be converted to the targetMysqlType before being sent to the database.
- Specified by:
setObject
in interfaceQueryBindings<T extends BindValue>
- Parameters:
parameterIndex
- the first parameter is 1...parameterObj
- the object containing the input parameter valuetargetMysqlType
- The MysqlType to be send to the databasescaleOrLength
- For Types.DECIMAL or Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored.
-
setSerializableObject
protected final void setSerializableObject(int parameterIndex, java.lang.Object parameterObj)Sets the value for the placeholder as a serialized Java object (used by various forms of setObject()- Parameters:
parameterIndex
- parameter indexparameterObj
- value
-
isNull
public boolean isNull(int parameterIndex)- Specified by:
isNull
in interfaceQueryBindings<T extends BindValue>
-
getBytesRepresentation
public byte[] getBytesRepresentation(int parameterIndex)- Specified by:
getBytesRepresentation
in interfaceQueryBindings<T extends BindValue>
-