java.sql.PreparedStatement#getResultSetConcurrency ( )源码实例Demo

下面列出了java.sql.PreparedStatement#getResultSetConcurrency ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: requery   文件: StatementCachingConnection.java
@Override
public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability) throws SQLException {
    PreparedStatement statement = statementCache.get(sql);
    if (statement != null &&
        statement.getResultSetType() == resultSetType &&
        statement.getResultSetConcurrency() == resultSetConcurrency &&
        statement.getResultSetHoldability() == resultSetHoldability) {
        return statement;
    }
    statement = super.prepareStatement(sql, resultSetType,
            resultSetConcurrency, resultSetHoldability);
    return statementCache.put(sql, statement);
}
 
源代码2 项目: gemfirexd-oss   文件: FromVTI.java
/**
 * Get the ResultSetMetaData for the class/object.  We first look for 
 * the optional static method which has the same signature as the constructor.
 * If it doesn't exist, then we instantiate an object and get the ResultSetMetaData
 * from that object.
 *
 * @return The ResultSetMetaData from the class/object.
 *
 * @exception StandardException		Thrown on error
 */
public ResultSetMetaData getResultSetMetaData() 
	throws StandardException
{
	// Get the actual 
	ResultSetMetaData rsmd = null;

	try
	{	
		if (version2)
		{
			ps = (PreparedStatement) getNewInstance();

			if (ps.getResultSetConcurrency() != ResultSet.CONCUR_UPDATABLE)
			{
				throw StandardException.newException(SQLState.LANG_UPDATABLE_VTI_NON_UPDATABLE_RS, 
													 getVTIName());
			}

			rsmd = ps.getMetaData();

               controlsDeferral = (ps instanceof DeferModification);

               /* See if the result set is known to be insensitive or not.
                *
                * Some older VTI implementations do not implement getResultSetType(). UpdatableVTITemplate
                * does not implement it at all. UpdatableVTITemplate.getResultSetType throws an
                * exception. In either of these cases make the conservative assumption that the result set is sensitive.
                */
               try
               {
                   resultSetType = ps.getResultSetType();
               }
               catch( SQLException sqle){}
               catch( java.lang.AbstractMethodError ame){}
               catch( java.lang.NoSuchMethodError nsme){}
               isInsensitive = (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE);

			if (!implementsVTICosting) {
				ps.close();
				ps = null;
			}

		}
		else
		{
			rs = (ResultSet) getNewInstance();

			rsmd = rs.getMetaData();

			if (!implementsVTICosting) {
				rs.close();
				rs = null;
			}
		}
	}
	catch(Throwable t)
	{
		throw StandardException.unexpectedUserException(t);
	}

	return rsmd;
}
 
源代码3 项目: gemfirexd-oss   文件: FromVTI.java
/**
 * Get the ResultSetMetaData for the class/object.  We first look for 
 * the optional static method which has the same signature as the constructor.
 * If it doesn't exist, then we instantiate an object and get the ResultSetMetaData
 * from that object.
 *
 * @return The ResultSetMetaData from the class/object.
 *
 * @exception StandardException		Thrown on error
 */
public ResultSetMetaData getResultSetMetaData() 
	throws StandardException
{
	// Get the actual 
	ResultSetMetaData rsmd = null;

	try
	{	
		if (version2)
		{
			ps = (PreparedStatement) getNewInstance();

			if (ps.getResultSetConcurrency() != ResultSet.CONCUR_UPDATABLE)
			{
				throw StandardException.newException(SQLState.LANG_UPDATABLE_VTI_NON_UPDATABLE_RS, 
													 getVTIName());
			}

			rsmd = ps.getMetaData();

               controlsDeferral = (ps instanceof DeferModification);

               /* See if the result set is known to be insensitive or not.
                *
                * Some older VTI implementations do not implement getResultSetType(). UpdatableVTITemplate
                * does not implement it at all. UpdatableVTITemplate.getResultSetType throws an
                * exception. In either of these cases make the conservative assumption that the result set is sensitive.
                */
               try
               {
                   resultSetType = ps.getResultSetType();
               }
               catch( SQLException sqle){}
               catch( java.lang.AbstractMethodError ame){}
               catch( java.lang.NoSuchMethodError nsme){}
               isInsensitive = (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE);

			if (!implementsVTICosting) {
				ps.close();
				ps = null;
			}

		}
		else
		{
			rs = (ResultSet) getNewInstance();

			rsmd = rs.getMetaData();

			if (!implementsVTICosting) {
				rs.close();
				rs = null;
			}
		}
	}
	catch(Throwable t)
	{
		throw StandardException.unexpectedUserException(t);
	}

	return rsmd;
}
 
源代码4 项目: skywalking   文件: SwPreparedStatementTest.java
@Test
public void testPreparedStatementConfig() throws SQLException {
    PreparedStatement preparedStatement = swConnection.prepareStatement("INSERT INTO test VALUES( ? , ?)", 1);
    preparedStatement.setInt(1, 1);
    preparedStatement.setString(2, "a");
    preparedStatement.getUpdateCount();
    preparedStatement.setFetchDirection(1);
    preparedStatement.getFetchDirection();
    preparedStatement.getResultSetConcurrency();
    preparedStatement.getResultSetType();
    preparedStatement.isClosed();
    preparedStatement.setPoolable(false);
    preparedStatement.isPoolable();
    preparedStatement.getWarnings();
    preparedStatement.clearWarnings();
    preparedStatement.setCursorName("test");
    preparedStatement.setMaxFieldSize(11);
    preparedStatement.getMaxFieldSize();
    preparedStatement.setMaxRows(10);
    preparedStatement.getMaxRows();
    preparedStatement.getParameterMetaData();
    preparedStatement.setEscapeProcessing(true);
    preparedStatement.setFetchSize(1);
    preparedStatement.getFetchSize();
    preparedStatement.setQueryTimeout(1);
    preparedStatement.getQueryTimeout();
    Connection connection = preparedStatement.getConnection();

    preparedStatement.execute();

    preparedStatement.getMoreResults();
    preparedStatement.getMoreResults(1);
    preparedStatement.getResultSetHoldability();
    preparedStatement.getMetaData();
    preparedStatement.getResultSet();

    preparedStatement.close();
    verify(mysqlPreparedStatement).getUpdateCount();
    verify(mysqlPreparedStatement).getMoreResults();
    verify(mysqlPreparedStatement).setFetchDirection(anyInt());
    verify(mysqlPreparedStatement).getFetchDirection();
    verify(mysqlPreparedStatement).getResultSetType();
    verify(mysqlPreparedStatement).isClosed();
    verify(mysqlPreparedStatement).setPoolable(anyBoolean());
    verify(mysqlPreparedStatement).getWarnings();
    verify(mysqlPreparedStatement).clearWarnings();
    verify(mysqlPreparedStatement).setCursorName(anyString());
    verify(mysqlPreparedStatement).setMaxFieldSize(anyInt());
    verify(mysqlPreparedStatement).getMaxFieldSize();
    verify(mysqlPreparedStatement).setMaxRows(anyInt());
    verify(mysqlPreparedStatement).getMaxRows();
    verify(mysqlPreparedStatement).setEscapeProcessing(anyBoolean());
    verify(mysqlPreparedStatement).getResultSetConcurrency();
    verify(mysqlPreparedStatement).getResultSetConcurrency();
    verify(mysqlPreparedStatement).getResultSetType();
    verify(mysqlPreparedStatement).getMetaData();
    verify(mysqlPreparedStatement).getParameterMetaData();
    verify(mysqlPreparedStatement).getMoreResults(anyInt());
    verify(mysqlPreparedStatement).setFetchSize(anyInt());
    verify(mysqlPreparedStatement).getFetchSize();
    verify(mysqlPreparedStatement).getQueryTimeout();
    verify(mysqlPreparedStatement).setQueryTimeout(anyInt());
    verify(mysqlPreparedStatement).getResultSet();
    assertThat(connection, CoreMatchers.<Connection>is(swConnection));
}