Package com.alibaba.druid.util
Class MySqlUtils
java.lang.Object
com.alibaba.druid.util.MySqlUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringbuildKillQuerySql(Connection connection, SQLException error) static XAConnectioncreateXAConnection(Driver driver, Connection physicalConn) static BigDecimaldecimal(BigDecimal value, int precision, int scale) static Stringstatic Classstatic Stringstatic StringgetCreateTableScript(Connection conn, boolean sorted, boolean simplify) static Longstatic longDeprecated.getTableDDL(Connection conn, List<String> tables) static booleanisBuiltinDataType(String dataType) static booleanstatic booleanstatic booleanstatic voidloadDataTypes(Set<String> dataTypes) static Datestatic ZonedDateTimeparseDateTime(byte[] str, int off, int len, ZoneId zoneId) static longparseMillis(byte[] str, int off, int len, TimeZone timeZone) static longparseMillis(byte[] str, TimeZone timeZone) static TimeZoneparseTimeZone(String str) showTables(Connection conn) static DateFormattoJavaFormat(String fmt) static DateFormattoJavaFormat(String fmt, TimeZone timeZone) static Stringstatic Stringstatic String
-
Field Details
-
GBK
-
BIG5
-
UTF8
-
UTF16
-
UTF32
-
ASCII
-
-
Constructor Details
-
MySqlUtils
public MySqlUtils()
-
-
Method Details
-
createXAConnection
public static XAConnection createXAConnection(Driver driver, Connection physicalConn) throws SQLException - Throws:
SQLException
-
buildKillQuerySql
public static String buildKillQuerySql(Connection connection, SQLException error) throws SQLException - Throws:
SQLException
-
isKeyword
-
isBuiltinDataType
-
showTables
- Throws:
SQLException
-
getTableDDL
- Throws:
SQLException
-
getCreateTableScript
- Throws:
SQLException
-
getCreateTableScript
public static String getCreateTableScript(Connection conn, boolean sorted, boolean simplify) throws SQLException - Throws:
SQLException
-
getId
-
getLastPacketReceivedTimeMs
Deprecated.The lastQueryFinishedTime, returned from mysql8 com.mysql.cj.jdbc.JdbcConnection#getIdleFor, does not be updated by method pingInternal running for connection validation if option usePingMethod is true.
More troublesome is that lastQueryFinishedTime will not be set if option maintainTimeStats is false, so does mysql5 lastPacketReceivedTimeMs.- Throws:
SQLException
-
getCommunicationsExceptionClass
-
loadDataTypes
-
decimal
-
isNumber
-
toJavaFormat
-
toJavaFormat
-
parseDate
-
parseMillis
-
parseMillis
-
parseDateTime
-
isSupportParseDateformat
-
parseTimeZone
-
utf32
-
utf16
-
utf8
-
gbk
-
big5
-