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


Java SQLFeatureNotSupportedException类代码示例

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


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

示例1: setQueryTimeout

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void setQueryTimeout( int milliseconds )
    throws SQLException {
  throwIfClosed();
  if ( milliseconds < 0 ) {
    throw new InvalidParameterSqlException(
        "Invalid (negative) \"milliseconds\" parameter to setQueryTimeout(...)"
        + " (" + milliseconds + ")" );
  }
  else {
    if ( 0 != milliseconds ) {
      throw new SQLFeatureNotSupportedException(
          "Setting network timeout is not supported." );
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:DremioStatementImpl.java

示例2: lessThanOrEqualTest

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Test
public void lessThanOrEqualTest() throws IOException, SqlParseException, SQLFeatureNotSupportedException {
	int someAge = 25;
	SearchHits response = query(String.format("SELECT * FROM %s WHERE age <= %s LIMIT 1000", TEST_INDEX, someAge));
	SearchHit[] hits = response.getHits();

	boolean isEqualFound = false;
	for(SearchHit hit : hits) {
		int age = (int) hit.getSource().get("age");
		assertThat(age, lessThanOrEqualTo(someAge));

		if(age == someAge)
			isEqualFound = true;
	}

	Assert.assertTrue(String.format("at least one of the documents need to contains age equal to %s", someAge), isEqualFound);
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:18,代码来源:QueryTest.java

示例3: testParamSettingWhenUnsupportedTypeSaysUnsupported

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
/** Tests that "not supported" has priority over possible "type not supported"
 *  check. */
@Test( expected = SQLFeatureNotSupportedException.class )
public void testParamSettingWhenUnsupportedTypeSaysUnsupported() throws SQLException {
  PreparedStatement prepStmt = connection.prepareStatement( "VALUES 1" );
  try {
    prepStmt.setClob( 2, (Clob) null );
  }
  catch ( final SQLFeatureNotSupportedException e ) {
    assertThat(
        "Check whether params.-unsupported wording changed or checks changed.",
        e.toString(), PARAMETERS_NOT_SUPPORTED_MSG_MATCHER );
    throw e;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:PreparedStatementTest.java

示例4: othersUpdatesAreVisible

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public boolean othersUpdatesAreVisible(int type) throws SQLException {
  throwIfClosed();
  try {
    return super.othersUpdatesAreVisible(type);
  }
  catch (RuntimeException e) {
    if ("todo: implement this method".equals(e.getMessage())) {
      throw new SQLFeatureNotSupportedException(
          "othersUpdatesAreVisible(int) is not supported", e);
    }
    else {
      throw new SQLException(e.getMessage(), e);
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:DremioDatabaseMetaDataImpl.java

示例5: setNetworkTimeout

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void setNetworkTimeout( Executor executor, int milliseconds )
    throws AlreadyClosedSqlException,
           JdbcApiSqlException,
           SQLFeatureNotSupportedException {
  checkNotClosed();
  if ( null == executor ) {
    throw new InvalidParameterSqlException(
        "Invalid (null) \"executor\" parameter to setNetworkTimeout(...)" );
  }
  else if ( milliseconds < 0 ) {
    throw new InvalidParameterSqlException(
        "Invalid (negative) \"milliseconds\" parameter to setNetworkTimeout(...)"
        + " (" + milliseconds + ")" );
  }
  else {
    if ( 0 != milliseconds ) {
      throw new SQLFeatureNotSupportedException(
          "Setting network timeout is not supported." );
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:DrillConnectionImpl.java

示例6: topHitTest_WithInclude

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Test
public void topHitTest_WithInclude() throws IOException, SqlParseException, SQLFeatureNotSupportedException {
    Aggregations result = query(String.format("select topHits('size'=3,age='desc',include=age) from %s/account group by gender ", TEST_INDEX));
    List<Terms.Bucket> buckets = ((Terms) (result.asList().get(0))).getBuckets();
    for (Terms.Bucket bucket : buckets){
        InternalSearchHits hits = (InternalSearchHits) ((InternalTopHits) bucket.getAggregations().asList().get(0)).getHits();
        for(SearchHit hit: hits ){
            Set<String> fields = hit.sourceAsMap().keySet();
            Assert.assertEquals(1,fields.size());
            Assert.assertEquals("age",fields.toArray()[0]);
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:14,代码来源:AggregationTest.java

示例7: getResultSetType

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public int getResultSetType() throws SQLException {
  throwIfClosed();
  try {
    return super.getResultSetType();
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioStatementImpl.java

示例8: updateBlob

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void updateBlob( String columnLabel, Blob x ) throws SQLException {
  throwIfClosed();
  try {
    super.updateBlob( columnLabel, x );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioResultSetImpl.java

示例9: updateNCharacterStream

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void updateNCharacterStream( int columnIndex, Reader x,
                                    long length ) throws SQLException {
  throwIfClosed();
  try {
    super.updateNCharacterStream( columnIndex, x, length );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:DremioResultSetImpl.java

示例10: doTranslate

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
	if (ex instanceof SQLTransientException) {
		if (ex instanceof SQLTransientConnectionException) {
			return new TransientDataAccessResourceException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLTransactionRollbackException) {
			return new ConcurrencyFailureException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLTimeoutException) {
			return new QueryTimeoutException(buildMessage(task, sql, ex), ex);
		}
	}
	else if (ex instanceof SQLNonTransientException) {
		if (ex instanceof SQLNonTransientConnectionException) {
			return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLDataException) {
			return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLIntegrityConstraintViolationException) {
			return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLInvalidAuthorizationSpecException) {
			return new PermissionDeniedDataAccessException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLSyntaxErrorException) {
			return new BadSqlGrammarException(task, sql, ex);
		}
		else if (ex instanceof SQLFeatureNotSupportedException) {
			return new InvalidDataAccessApiUsageException(buildMessage(task, sql, ex), ex);
		}
	}
	else if (ex instanceof SQLRecoverableException) {
		return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex);
	}

	// Fallback to Spring's own SQL state translation...
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:SQLExceptionSubclassTranslator.java

示例11: updateClob

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void updateClob( String columnLabel,  Reader reader,
                        long length ) throws SQLException {
  throwIfClosed();
  try {
    super.updateClob( columnLabel, reader, length );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:DremioResultSetImpl.java

示例12: executeUpdate

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public int executeUpdate( String sql, String[] columnNames ) throws SQLException {
  throwIfClosed();
  try {
    return super.executeUpdate( sql, columnNames );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioStatementImpl.java

示例13: statsTest

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Test
public void statsTest() throws IOException, SqlParseException, SQLFeatureNotSupportedException {
	Aggregations result = query(String.format("SELECT STATS(age) FROM %s/account", TEST_INDEX));
	Stats stats = result.get("STATS(age)");
	Assert.assertEquals(1000, stats.getCount());
	assertThat(stats.getSum(), equalTo(30171.0));
	assertThat(stats.getMin(), equalTo(20.0));
	assertThat(stats.getMax(), equalTo(40.0));
	assertThat(stats.getAvg(), equalTo(30.171));
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:11,代码来源:AggregationTest.java

示例14: updateNClob

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
@Override
public void updateNClob( String columnLabel,  Reader reader ) throws SQLException {
  throwIfClosed();
  try {
    super.updateNClob( columnLabel, reader );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioResultSetImpl.java

示例15: testSetQueryTimeoutRejectsTimeoutRequest

import java.sql.SQLFeatureNotSupportedException; //导入依赖的package包/类
/** Tests that setQueryTimeout(...) rejects setting a timeout. */
@Test( expected = SQLFeatureNotSupportedException.class )
public void testSetQueryTimeoutRejectsTimeoutRequest() throws SQLException {
  try {
    statement.setQueryTimeout( 1_000 );
  }
  catch ( SQLFeatureNotSupportedException e ) {
    // Check exception for some mention of query timeout:
    assertThat( e.getMessage(), anyOf( containsString( "Timeout" ),
                                       containsString( "timeout" ) ) );
    throw e;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:StatementTest.java


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