当前位置: 首页>>代码示例>>Java>>正文


Java ResultSetUtil类代码示例

本文整理汇总了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();
            }
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:38,代码来源:MysqlIO.java

示例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();
              }
          }
      }
  }
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:42,代码来源:MysqlIO.java

示例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();
            }
        }
    }
}
 
开发者ID:BasThomas,项目名称:SMPT42,代码行数:38,代码来源:MysqlIO.java


注:本文中的com.mysql.jdbc.util.ResultSetUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。