パッケージ org.postgresql.core
クラス Utils
java.lang.Object
org.postgresql.core.Utils
Collection of utilities used by the protocol-level code.
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明static StringBuilder
escapeIdentifier
(@Nullable StringBuilder sbuf, String value) Escape the given identifiervalue
and append it to the string buildersbuf
.static StringBuilder
escapeLiteral
(@Nullable StringBuilder sbuf, String value, boolean standardConformingStrings) Escape the given literalvalue
and append it to the string buildersbuf
.static int
parseServerVersionStr
(@Nullable String serverVersion) 推奨されていません。static String
toHexString
(byte[] data) Turn a bytearray into a printable form, representing each byte in hex.
-
コンストラクタの詳細
-
Utils
public Utils()
-
-
メソッドの詳細
-
toHexString
Turn a bytearray into a printable form, representing each byte in hex.- パラメータ:
data
- the bytearray to stringize- 戻り値:
- a hex-encoded printable representation of
data
-
escapeLiteral
public static StringBuilder escapeLiteral(@Nullable StringBuilder sbuf, String value, boolean standardConformingStrings) throws SQLException Escape the given literalvalue
and append it to the string buildersbuf
. Ifsbuf
isnull
, a new StringBuilder will be returned. The argumentstandardConformingStrings
defines whether the backend expects standard-conforming string literals or allows backslash escape sequences.- パラメータ:
sbuf
- the string builder to append to; ornull
value
- the string valuestandardConformingStrings
- if standard conforming strings should be used- 戻り値:
- the sbuf argument; or a new string builder for sbuf == null
- 例外:
SQLException
- if the string contains a\0
character
-
escapeIdentifier
public static StringBuilder escapeIdentifier(@Nullable StringBuilder sbuf, String value) throws SQLException Escape the given identifiervalue
and append it to the string buildersbuf
. Ifsbuf
isnull
, a new StringBuilder will be returned. This method is different from appendEscapedLiteral in that it includes the quoting required for the identifier whileescapeLiteral(StringBuilder, String, boolean)
does not.- パラメータ:
sbuf
- the string builder to append to; ornull
value
- the string value- 戻り値:
- the sbuf argument; or a new string builder for sbuf == null
- 例外:
SQLException
- if the string contains a\0
character
-
parseServerVersionStr
@Deprecated public static int parseServerVersionStr(@Nullable String serverVersion) throws NumberFormatException 推奨されていません。use specificVersion
instanceAttempt to parse the server version string into an XXYYZZ form version number.
Returns 0 if the version could not be parsed.
Returns minor version 0 if the minor version could not be determined, e.g. devel or beta releases.
If a single major part like 90400 is passed, it's assumed to be a pre-parsed version and returned verbatim. (Anything equal to or greater than 10000 is presumed to be this form).
The yy or zz version parts may be larger than 99. A NumberFormatException is thrown if a version part is out of range.
- パラメータ:
serverVersion
- server version in a XXYYZZ form- 戻り値:
- server version in number form
- 例外:
NumberFormatException
-
Version
instance