微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.sql.SQLFeatureNotSupportedException的实例源码

项目:dremio-oss    文件DremioStatementImpl.java   
@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." );
    }
  }
}
项目:es-sql    文件QueryTest.java   
@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);
}
项目:QDrill    文件PreparedStatementTest.java   
/** 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;
  }
}
项目:dremio-oss    文件DremioDatabaseMetaDataimpl.java   
@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);
    }
  }
}
项目:QDrill    文件DrillConnectionImpl.java   
@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." );
    }
  }
}
项目:es-sql    文件AggregationTest.java   
@Test
public void topHitTest_WithInclude() throws IOException,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]);
        }
    }
}
项目:dremio-oss    文件DremioStatementImpl.java   
@Override
public int getResultSetType() throws sqlException {
  throwIfClosed();
  try {
    return super.getResultSetType();
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@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);
  }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@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);
  }
}
项目:lams    文件sqlExceptionSubclasstranslator.java   
@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,ex);
        }
        else if (ex instanceof sqlTimeoutException) {
            return new QueryTimeoutException(buildMessage(task,ex);
        }
    }
    else if (ex instanceof sqlNonTransientException) {
        if (ex instanceof sqlNonTransientConnectionException) {
            return new DataAccessResourceFailureException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlDataException) {
            return new DataIntegrityViolationException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlIntegrityConstraintViolationException) {
            return new DataIntegrityViolationException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlInvalidAuthorizationSpecException) {
            return new PermissionDeniedDataAccessException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlSyntaxErrorException) {
            return new BadsqlGrammarException(task,ex);
        }
        else if (ex instanceof sqlFeatureNotSupportedException) {
            return new InvalidDataAccessApiUsageException(buildMessage(task,ex);
        }
    }
    else if (ex instanceof sqlRecoverableException) {
        return new RecoverableDataAccessException(buildMessage(task,ex);
    }

    // Fallback to Spring's own sql state translation...
    return null;
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateClob( String columnLabel,Reader reader,long length ) throws sqlException {
  throwIfClosed();
  try {
    super.updateClob( columnLabel,reader,e);
  }
}
项目:dremio-oss    文件DremioStatementImpl.java   
@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);
  }
}
项目:es-sql    文件AggregationTest.java   
@Test
public void statstest() throws IOException,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));
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@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);
  }
}
项目:dremio-oss    文件StatementTest.java   
/** 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;
  }
}
项目:dremio-oss    文件DremioStatementImpl.java   
@Override
public void setPoolable(boolean poolable) throws sqlException {
  throwIfClosed();
  try {
    super.setPoolable(poolable);
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:es-sql    文件JoinTests.java   
private void joinNoConditionAndNowhere(boolean usenestedLoops) throws sqlParseException,sqlFeatureNotSupportedException,IOException {
    String query = String.format("select c.name.firstname,c.parents.father,h.hname,h.words from %s/gotCharacters c " +
            "JOIN %s/gotHouses h ",TEST_INDEX);
    if(usenestedLoops) query = query.replace("select","select /*! USE_NL*/ ");
    SearchHit[] hits = joinAndGetHits(query);
    Assert.assertEquals(12,hits.length);
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateDouble( int columnIndex,double x ) throws sqlException {
  throwIfClosed();
  try {
    super.updateDouble( columnIndex,e);
  }
}
项目:es-sql    文件AggregationTest.java   
@Test
public void geoBounds() throws sqlFeatureNotSupportedException,sqlParseException {
    Aggregations result = query(String.format("SELECT * FROM %s/location GROUP BY geo_bounds(field='center',alias='bounds') ",TEST_INDEX));
    InternalGeoBounds bounds = result.get("bounds");
    Assert.assertEquals(0.5,bounds.bottomright().getLat(),0.001);
    Assert.assertEquals(105.0,bounds.bottomright().getLon(),0.001);
    Assert.assertEquals(5.0,bounds.topLeft().getLat(),0.001);
    Assert.assertEquals(100.5,bounds.topLeft().getLon(),0.001);
}
项目:OpenVertretung    文件ConnectionRegressionTest.java   
/**
 * Tests fix for Bug#56122 - JDBC4 functionality failure when using replication connections.
 */
public void testBug56122() throws Exception {
    for (final Connection testConn : new Connection[] { this.conn,getFailoverConnection(),getLoadBalancedConnection(),getMasterSlaveReplicationConnection() }) {
        testConn.createClob();
        testConn.createBlob();
        testConn.createNClob();
        testConn.createsqlXML();
        testConn.isValid(12345);
        testConn.setClientInfo(new Properties());
        testConn.setClientInfo("NAME","VALUE");
        testConn.getClientInfo();
        testConn.getClientInfo("CLIENT");
        assertThrows(sqlFeatureNotSupportedException.class,new Callable<Void>() {
            public Void call() throws Exception {
                testConn.createArrayOf("A_TYPE",null);
                return null;
            }
        });
        assertThrows(sqlFeatureNotSupportedException.class,new Callable<Void>() {
            public Void call() throws Exception {
                testConn.createStruct("A_TYPE",null);
                return null;
            }
        });
    }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateObject( String columnLabel,Object x,int scaleOrLength ) throws sqlException {
  throwIfClosed();
  try {
    super.updateObject( columnLabel,scaleOrLength );
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateCharacterStream( String columnLabel,int length ) throws sqlException {
  throwIfClosed();
  try {
    super.updateCharacterStream( columnLabel,e);
  }
}
项目:dremio-oss    文件DremioPreparedStatementImpl.java   
@Override
public void setCursorName(String name) throws sqlException {
  throwIfClosed();
  try {
    super.setCursorName(name);
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:es-sql    文件QueryTest.java   
@Test
public void intest() throws IOException,sqlFeatureNotSupportedException{
    SearchHits response = query(String.format("SELECT age FROM %s/phrase WHERE age IN (20,22) LIMIT 1000",TEST_INDEX));
    SearchHit[] hits = response.getHits();
    for(SearchHit hit : hits) {
        int age = (int) hit.getSource().get("age");
        assertthat(age,isOneOf(20,22));
    }
}
项目:dremio-oss    文件DremioConnectionImpl.java   
@Override
public void commit() throws sqlException {
  throwIfClosed();
  if ( getAutoCommit() ) {
    throw new JdbcApisqlException( "Can't call commit() in auto-commit mode." );
  }
  else {
    // (Currently not reachable.)
    throw new sqlFeatureNotSupportedException(
        "Connection.commit() is not supported.  (Dremio is not transactional.)" );
  }
}
项目:dremio-oss    文件DremioPreparedStatementImpl.java   
@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);
  }
}
项目:dremio-oss    文件DremioStatementImpl.java   
@Override
public void clearBatch() throws sqlException {
  throwIfClosed();
  try {
    super.clearBatch();
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateBinaryStream( int columnIndex,InputStream x ) throws sqlException {
  throwIfClosed();
  try {
    super.updateBinaryStream( columnIndex,e);
  }
}
项目:dremio-oss    文件DremioPreparedStatementImpl.java   
@Override
public int getMaxFieldSize() throws sqlException {
  throwIfClosed();
  try {
    return super.getMaxFieldSize();
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:dremio-oss    文件DremioPreparedStatementImpl.java   
@Override
public ResultSet getGeneratedKeys() throws sqlException {
  throwIfClosed();
  try {
    return super.getGeneratedKeys();
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:dremio-oss    文件DremioConnectionImpl.java   
@Override
public Properties getClientInfo() throws sqlException {
  throwIfClosed();
  try {
    return super.getClientInfo();
  }
  catch (UnsupportedOperationException e) {
    throw new sqlFeatureNotSupportedException(e.getMessage(),e);
  }
}
项目:es-sql    文件QueryTest.java   
@Test
public void lessthantest() throws IOException,sqlFeatureNotSupportedException {
    int someAge = 25;
    SearchHits response = query(String.format("SELECT * FROM %s WHERE age < %s LIMIT 1000",someAge));
    SearchHit[] hits = response.getHits();
    for(SearchHit hit : hits) {
        int age = (int) hit.getSource().get("age");
        assertthat(age,lessthan(someAge));
    }
}
项目:es-sql    文件QueryTest.java   
@Test
public void complexObjectReutrnField() throws IOException,sqlFeatureNotSupportedException{
    SearchHits response = query(String.format("SELECT parents.father FROM %s/gotCharacters where name.firstname = 'Brandon' LIMIT 1000",TEST_INDEX));
    Assert.assertEquals(1,response.getTotalHits());
    Map<String,Object> sourceAsMap = response.getHits()[0].sourceAsMap();
    Assert.assertEquals("Eddard",((HashMap<String,Object>)sourceAsMap.get("parents")).get("father"));
}
项目:spanner-jdbc    文件AbstractCloudSpannerConnectionTest.java   
@Test
public void testRollback() throws Exception
{
    thrown.expect(sqlFeatureNotSupportedException.class);
    AbstractCloudSpannerConnection testSubject;
    Savepoint savepoint = null;

    // default test
    testSubject = createTestSubject();
    testSubject.rollback(savepoint);
}
项目:es-sql    文件JoinTests.java   
private void hintLimits_firstNullSecondLimit(boolean usenestedLoops) throws sqlParseException,IOException {
    String query = String.format("select /*! JOIN_TABLES_LIMIT(null,2) */ c.name.firstname,"select /*! USE_NL*/ ");
    SearchHit[] hits = joinAndGetHits(query);
    Assert.assertEquals(8,hits.length);
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateRowId( int columnIndex,RowId x ) throws sqlException {
  throwIfClosed();
  try {
    super.updateRowId( columnIndex,e);
  }
}
项目:dremio-oss    文件DremioResultSetImpl.java   
@Override
public void updateClob( int columnIndex,long length ) throws sqlException {
  throwIfClosed();
  try {
    super.updateClob( columnIndex,e);
  }
}
项目:es-sql    文件AggregationTest.java   
@Test
public void limittest() throws IOException,sqlFeatureNotSupportedException {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY age ORDER BY COUNT(*) LIMIT 5",TEST_INDEX));
    Terms age = result.get("age");

    assertthat(age.getBuckets().size(),equalTo(5));
}
项目:es-sql    文件QueryTest.java   
@Test
public void notLiketest() throws IOException,sqlFeatureNotSupportedException {
    SearchHits response = query(String.format("SELECT * FROM %s/account WHERE firstname NOT LIKE 'amb%%'",TEST_INDEX));
    SearchHit[] hits = response.getHits();

    // assert we got hits
    Assert.assertNotEquals(0,response.getTotalHits());
    for (SearchHit hit : hits) {
        Assert.assertFalse(hit.getSource().get("firstname").toString().toLowerCase().startsWith("amb"));
    }
}
项目:es-sql    文件QueryTest.java   
@Test
public void geodistance() throws sqlFeatureNotSupportedException,InterruptedException {
    SearchHits results = query(String.format("SELECT * FROM %s/location WHERE GEO_disTANCE(center,'1km',100.5,0.500001)",TEST_INDEX));
    org.junit.Assert.assertEquals(1,results.getTotalHits());
    SearchHit result = results.getAt(0);
    Assert.assertEquals("square",result.getSource().get("description"));
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。