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


Java ResultSet.getStatement方法代码示例

本文整理汇总了Java中java.sql.ResultSet.getStatement方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.getStatement方法的具体用法?Java ResultSet.getStatement怎么用?Java ResultSet.getStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.ResultSet的用法示例。


在下文中一共展示了ResultSet.getStatement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPostgreSqlnputStream

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
    * Extract the Large Object Input Stream from PostgreSQL
    * 
    * @param resultSet
    *            the Result Set to extract the blob from
    * @param columnIndex
    *            the index of column
    * @return the Large Object Input Stream from PostgreSQL
    * @throws SQLException
    */
   public static InputStream getPostgreSqlnputStream(ResultSet resultSet,
    int columnIndex) throws SQLException {
InputStream in;
Statement statement = resultSet.getStatement();
Connection conn = statement.getConnection();

// Get the Large Object Manager to perform operations with
LargeObjectManager lobj = ((org.postgresql.PGConnection) conn)
	.getLargeObjectAPI();
long oid = resultSet.getLong(columnIndex);

if (oid < 1) {
    return null;
}

LargeObject obj = lobj.open(oid, LargeObjectManager.READ);

in = obj.getInputStream();
return in;
   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:31,代码来源:PostgreSqlUtil.java

示例2: register

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public void register(ResultSet resultSet, Statement statement) {
	if ( statement == null ) {
		try {
			statement = resultSet.getStatement();
		}
		catch ( SQLException e ) {
			throw exceptionHelper.convert( e, "unable to access statement from resultset" );
		}
	}
	if ( statement != null ) {
		LOG.tracev( "Registering result set [{0}]", resultSet );
		Set<ResultSet> resultSets = xref.get( statement );
		if ( resultSets == null ) {
			LOG.unregisteredStatement();
		}
		if ( resultSets == null || resultSets == EMPTY_RESULTSET ) {
			resultSets = new HashSet<ResultSet>();
			xref.put( statement, resultSets );
		}
		resultSets.add( resultSet );
	}
	else {
		unassociatedResultSets.add( resultSet );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:JdbcCoordinatorImpl.java

示例3: close

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
 * Close connection
 *
 * @param rs
 */
public static void close(ResultSet rs) {
    Statement st = null;
    Connection con = null;
    try {
        try {
            if (rs != null) {
                st = rs.getStatement();
                rs.close();
            }
        } finally {
            try {
                if (st != null) {
                    con = st.getConnection();
                    st.close();
                }
            } finally {
                if (con != null) {
                    con.close();
                }
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:31,代码来源:JDBCUtils.java

示例4: getStatement

import java.sql.ResultSet; //导入方法依赖的package包/类
public static Statement getStatement(ResultSet resultSet) {
	try {
		return resultSet.getStatement();
	} catch (SQLException e) {
		throw new RuntimeException("Error getting statement from result set", e);
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:8,代码来源:DBUtil.java

示例5: getDatabaseProductName

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
    * Returns true if engine is terradata
    * 
    * @param resultSet
    *            the result set in use
    * @returns true if engine is terradata
    * @throws SQLException
    */
   private String getDatabaseProductName(ResultSet resultSet)
    throws SQLException {

Statement statement = resultSet.getStatement();

// happens on Metadata requests, we don' care about the result:
if (statement == null) {
    return "unknown";
} else {
    Connection connection = statement.getConnection();
    return new SqlUtil(connection).getDatabaseProductName();
}
   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:22,代码来源:ResultSetWriter.java

示例6: release

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public void release(ResultSet resultSet, Statement statement) {
	LOG.tracev( "Releasing result set [{0}]", resultSet );
	if ( statement == null ) {
		try {
			statement = resultSet.getStatement();
		}
		catch ( SQLException e ) {
			throw exceptionHelper.convert( e, "unable to access statement from resultset" );
		}
	}
	if ( statement != null ) {
		final Set<ResultSet> resultSets = xref.get( statement );
		if ( resultSets == null ) {
			LOG.unregisteredStatement();
		}
		else {
			resultSets.remove( resultSet );
			if ( resultSets.isEmpty() ) {
				xref.remove( statement );
			}
		}
	}
	else {
		final boolean removed = unassociatedResultSets.remove( resultSet );
		if ( !removed ) {
			LOG.unregisteredResultSetWithoutStatement();
		}
	}
	close( resultSet );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:JdbcCoordinatorImpl.java

示例7: registerMetaStatement

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
  * Registers a StatementInfo for the given ResultSet, returning the id under
  * which it is registered. This should be used for metadata ResultSets, which
  * have an implicit statement created.
  */
private int registerMetaStatement(ResultSet rs) throws SQLException {
  final int id = statementIdGenerator.getAndIncrement();
  StatementInfo statementInfo = new StatementInfo(rs.getStatement());
  statementInfo.setResultSet(rs);
  statementCache.put(id, statementInfo);
  return id;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:13,代码来源:JdbcMeta.java


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