public abstract class ParameterWriter extends Writer
MySqlParameters of parametrized statements with text-based protocol.| Constructor and Description |
|---|
ParameterWriter() |
| Modifier and Type | Method and Description |
|---|---|
abstract ParameterWriter |
append(char c)
Writes a character as a string.
|
abstract ParameterWriter |
append(@Nullable CharSequence csq)
Writes a
CharSequence as a string. |
abstract ParameterWriter |
append(@Nullable CharSequence csq,
int start,
int end)
Writes a subsequence of a
CharSequence as a string. |
void |
close()
NOOP.
|
void |
flush()
NOOP.
|
abstract void |
startHex()
Mark the following parameter is a hex byte buffer, replace the placeholder with
x'. |
abstract void |
startString()
Mark the following parameter is a string, prepare and wrap the placeholder with
'. |
abstract void |
write(@Nullable char[] c)
Writes a character array as a string.
|
abstract void |
write(@Nullable char[] c,
int off,
int len)
Writes a subsequence of a character array as a string.
|
abstract void |
write(int c)
Writes a character as a string.
|
abstract void |
write(@Nullable String str)
Writes a
String. |
abstract void |
write(@Nullable String str,
int off,
int len)
Writes a substring of a
String. |
abstract void |
writeBigDecimal(BigDecimal value)
Writes a value of
BigDecimal to current parameter. |
abstract void |
writeBigInteger(BigInteger value)
Writes a value of
BigInteger to current parameter. |
abstract void |
writeBinary(boolean bit)
Writes a value of binary data to current parameter with binary encoding.
|
abstract void |
writeDouble(double value)
Writes a value of
double to current parameter. |
abstract void |
writeFloat(float value)
Writes a value of
float to current parameter. |
abstract void |
writeHex(byte[] bytes)
Writes a value of binary data to current parameter with hex encoding.
|
abstract void |
writeHex(ByteBuffer buffer)
Writes a value of binary data to current parameter with hex encoding.
|
abstract void |
writeHex(long bits)
Writes a value of binary data to current parameter with hex encoding.
|
abstract void |
writeInt(int value)
Writes a value of
int to current parameter. |
abstract void |
writeLong(long value)
Writes a value of
long to current parameter. |
abstract void |
writeNull()
Writes a
null value to current parameter, nothing else can be written before or after this. |
public abstract void writeNull()
null value to current parameter, nothing else can be written before or after this.IllegalStateException - if parameters filled, or something was written before that.public abstract void writeInt(int value)
int to current parameter. If current mode is string mode, it will write as a
string like write(String.valueOf(value)). If it write as a numeric, nothing else can be written
before or after this.value - the value of int.IllegalStateException - if parameters filled, or a non-string value was written before numeric.public abstract void writeLong(long value)
long to current parameter. If current mode is string mode, it will write as a
string like write(String.valueOf(value)). If it write as a numeric, nothing else can be written
before or after this.value - the value of long.IllegalStateException - if parameters filled, or something was written before that numeric.public abstract void writeBigInteger(BigInteger value)
BigInteger to current parameter. If current mode is string mode, it will
write as a string like write(value.toString()). If it write as a numeric, nothing else can be
written before or after this.value - the value of BigInteger.IllegalArgumentException - the value is null.IllegalStateException - if parameters filled, or something was written before that numeric.public abstract void writeFloat(float value)
float to current parameter. If current mode is string mode, it will write as
a string like write(String.valueOf(value)). If it write as a numeric, nothing else can be
written before or after this.value - the value of float.IllegalStateException - if parameters filled, or something was written before that numeric.public abstract void writeDouble(double value)
double to current parameter. If current mode is string mode, it will write as
a string like write(String.valueOf(value)). If it write as a numeric, nothing else can be
written before or after this.value - the value of double.IllegalStateException - if parameters filled, or something was written before that numeric.public abstract void writeBigDecimal(BigDecimal value)
BigDecimal to current parameter. If current mode is string mode, it will
write as a string like write(value.toString()). If it write as a numeric, nothing else can be
written before or after this.value - the value of BigDecimal.IllegalArgumentException - the value is null.IllegalStateException - if parameters filled, or something was written before that numeric.public abstract void writeBinary(boolean bit)
bit - the binary data.IllegalStateException - if parameters filled, or other encoding was written before that.public abstract void writeHex(ByteBuffer buffer)
Note: to write binary data with text protocol, Hex or Base64 encoding should be used. And MySQL 5.5 Community Edition does not support Base64.
buffer - the binary data.IllegalArgumentException - if buffer is null.IllegalStateException - if parameters filled, or other encoding was written before that.public abstract void writeHex(byte[] bytes)
Note: write a binary data with text protocol need use Hex or Base64 encoding. And MySQL 5.5 Community Edition does not support Base64.
bytes - the binary data.IllegalArgumentException - if bytes is null.IllegalStateException - if parameters filled, or other encoding was written before that.public abstract void writeHex(long bits)
Note: write a binary data with text protocol need use Hex or Base64 encoding. And MySQL 5.5 Community Edition does not support Base64.
bits - the binary data bitmap, see also Long.toHexString(long).IllegalArgumentException - if bytes is null.IllegalStateException - if parameters filled, or other encoding was written before that.public abstract void startString()
'. If this
writer has been written a string value or marked as string mode, it will do nothing. Only string (or
stringify numeric) can be written before this.
It is useful for a string parameter starts with a number, like date or time. Also be used by reactive
streaming string parameter, like Clob.
IllegalStateException - if parameters filled, or a non-string value was written before calling.public abstract void startHex()
x'. If this
writer has been written a hex value or marked as hex mode, it will do nothing. Only hex value can be
written before this.
It is useful for reactive streaming byte buffer parameter, like Blob.
IllegalStateException - if parameters filled, or a non-hex value was written before calling.public abstract void write(int c)
write in class Writerc - an int specifying the character.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract ParameterWriter append(char c)
append in interface Appendableappend in class Writerc - the character.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract ParameterWriter append(@Nullable @Nullable CharSequence csq)
CharSequence as a string. Only string (or stringify numeric) can be written before
this. All character in string mode will be automatically escaped.append in interface Appendableappend in class Writercsq - the CharSequence.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract ParameterWriter append(@Nullable @Nullable CharSequence csq, int start, int end)
CharSequence as a string. Only string (or stringify numeric) can be
written before this. All character in string mode will be automatically escaped.append in interface Appendableappend in class Writercsq - the CharSequence.start - index of the first position in the subsequence of the csq.end - index of the sentinel position in the subsequence of the csq.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract void write(@Nullable
@Nullable String str)
String. Only string (or stringify numeric) can be written before this. All character
in string mode will be automatically escaped.write in class Writerstr - the String.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract void write(@Nullable
@Nullable String str,
int off,
int len)
String. Only string (or stringify numeric) can be written before this.
All character in string mode will be automatically escaped.write in class Writerstr - the String.off - index of the first position in the substring of the str.len - length of the substring.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract void write(@Nullable
@Nullable char[] c)
write in class Writerc - the character array.IllegalStateException - if parameters filled, or a non-string value was written before that.public abstract void write(@Nullable
@Nullable char[] c,
int off,
int len)
write in class Writerc - the character array.off - index of the first position in the subsequence of the c.len - length of the subsequence.IllegalStateException - if parameters filled, or a non-string value was written before that.public final void flush()
Copyright © 2018–2023 asyncer.io. All rights reserved.