當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。