本文整理汇总了Java中com.mysql.jdbc.util.ResultSetUtil类的典型用法代码示例。如果您正苦于以下问题:Java ResultSetUtil类的具体用法?Java ResultSetUtil怎么用?Java ResultSetUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultSetUtil类属于com.mysql.jdbc.util包,在下文中一共展示了ResultSetUtil类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: explainSlowQuery
import com.mysql.jdbc.util.ResultSetUtil; //导入依赖的package包/类
/**
* Runs an 'EXPLAIN' on the given query and dumps the results to the log
*
* @param querySQL
* @param truncatedQuery
*
* @throws SQLException
*/
protected void explainSlowQuery(byte[] querySQL, String truncatedQuery) throws SQLException {
if (StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery, EXPLAINABLE_STATEMENT)
|| (versionMeetsMinimum(5, 6, 3) && StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery, EXPLAINABLE_STATEMENT_EXTENSION) != -1)) {
PreparedStatement stmt = null;
java.sql.ResultSet rs = null;
try {
stmt = (PreparedStatement) this.connection.clientPrepareStatement("EXPLAIN ?");
stmt.setBytesNoEscapeNoQuotes(1, querySQL);
rs = stmt.executeQuery();
StringBuilder explainResults = new StringBuilder(Messages.getString("MysqlIO.8") + truncatedQuery + Messages.getString("MysqlIO.9"));
ResultSetUtil.appendResultSetSlashGStyle(explainResults, rs);
this.connection.getLog().logWarn(explainResults.toString());
} catch (SQLException sqlEx) {
} finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
}
}
}
示例2: explainSlowQuery
import com.mysql.jdbc.util.ResultSetUtil; //导入依赖的package包/类
/**
* Runs an 'EXPLAIN' on the given query and dumps the results to the log
*
* @param querySQL DOCUMENT ME!
* @param truncatedQuery DOCUMENT ME!
*
* @throws SQLException DOCUMENT ME!
*/
protected void explainSlowQuery(byte[] querySQL, String truncatedQuery)
throws SQLException {
if (StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery, EXPLAINABLE_STATEMENT)
|| (versionMeetsMinimum(5, 6, 3) && StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery,
EXPLAINABLE_STATEMENT_EXTENSION) != -1)) {
PreparedStatement stmt = null;
java.sql.ResultSet rs = null;
try {
stmt = (PreparedStatement) this.connection.clientPrepareStatement("EXPLAIN ?"); //$NON-NLS-1$
stmt.setBytesNoEscapeNoQuotes(1, querySQL);
rs = stmt.executeQuery();
StringBuffer explainResults = new StringBuffer(Messages.getString(
"MysqlIO.8") + truncatedQuery //$NON-NLS-1$
+Messages.getString("MysqlIO.9")); //$NON-NLS-1$
ResultSetUtil.appendResultSetSlashGStyle(explainResults, rs);
this.connection.getLog().logWarn(explainResults.toString());
} catch (SQLException sqlEx) {
} finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
}
}
}
示例3: explainSlowQuery
import com.mysql.jdbc.util.ResultSetUtil; //导入依赖的package包/类
/**
* Runs an 'EXPLAIN' on the given query and dumps the results to the log
*
* @param querySQL
* @param truncatedQuery
*
* @throws SQLException
*/
protected void explainSlowQuery(byte[] querySQL, String truncatedQuery) throws SQLException {
if (StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery, EXPLAINABLE_STATEMENT)
|| (versionMeetsMinimum(5, 6, 3) && StringUtils.startsWithIgnoreCaseAndWs(truncatedQuery, EXPLAINABLE_STATEMENT_EXTENSION) != -1)) {
PreparedStatement stmt = null;
java.sql.ResultSet rs = null;
try {
stmt = (PreparedStatement) this.connection.clientPrepareStatement("EXPLAIN ?");
stmt.setBytesNoEscapeNoQuotes(1, querySQL);
rs = stmt.executeQuery();
StringBuffer explainResults = new StringBuffer(Messages.getString("MysqlIO.8") + truncatedQuery + Messages.getString("MysqlIO.9"));
ResultSetUtil.appendResultSetSlashGStyle(explainResults, rs);
this.connection.getLog().logWarn(explainResults.toString());
} catch (SQLException sqlEx) {
} finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
}
}
}