Package java.sql

Examples of java.sql.Statement.unwrap()


          System.out.print(results.getString(i+1));
        }
        System.out.println();
      }
      System.out.println("Query Plan");
      System.out.println(statement.unwrap(TeiidStatement.class).getPlanDescription());
     
      results.close();
      statement.close();
    } catch (SQLException e) {
      e.printStackTrace();
View Full Code Here


 
  @Test public void testShowPlan() throws Exception {
    Statement s = conn.createStatement();
    s.execute("set showplan on");
    ResultSet rs = s.executeQuery("select * from all_tables");
    assertNotNull(s.unwrap(TeiidStatement.class).getPlanDescription());
    assertNull(s.unwrap(TeiidStatement.class).getDebugLog());
   
    rs = s.executeQuery("show plan");
    assertTrue(rs.next());
    assertEquals(rs.getMetaData().getColumnType(1), Types.CLOB);
View Full Code Here

  @Test public void testShowPlan() throws Exception {
    Statement s = conn.createStatement();
    s.execute("set showplan on");
    ResultSet rs = s.executeQuery("select * from all_tables");
    assertNotNull(s.unwrap(TeiidStatement.class).getPlanDescription());
    assertNull(s.unwrap(TeiidStatement.class).getDebugLog());
   
    rs = s.executeQuery("show plan");
    assertTrue(rs.next());
    assertEquals(rs.getMetaData().getColumnType(1), Types.CLOB);
    assertTrue(rs.getString(1).startsWith("ProjectNode"));
View Full Code Here

    assertNull(rs.getObject("DEBUG_LOG"));
    assertNotNull(rs.getObject("PLAN_TEXT"));
   
    s.execute("SET showplan debug");
    rs = s.executeQuery("select * from all_tables");
    assertNotNull(s.unwrap(TeiidStatement.class).getDebugLog());
   
    rs = s.executeQuery("show plan");
    assertTrue(rs.next());
    assertNotNull(rs.getObject("DEBUG_LOG"));
   
View Full Code Here

    assertTrue(rs.next());
    assertNotNull(rs.getObject("DEBUG_LOG"));
   
    s.execute("SET showplan off");
    rs = s.executeQuery("select * from all_tables");
    assertNull(s.unwrap(TeiidStatement.class).getPlanDescription());
    assertTrue(rs.next());
  }
 
  @Test public void testShow() throws Exception {
    Statement s = conn.createStatement();
View Full Code Here

        Preconditions.checkNotNull(this.phoenixConfiguration);
        Connection connection = null;
        try {
            connection = this.phoenixConfiguration.getConnection();
            final Statement  statement = connection.createStatement();
            final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
            final QueryPlan queryPlan = pstmt.compileQuery(selectStatement);
            isValidStatement(queryPlan);
            final String tableName = queryPlan.getTableRef().getTable().getName().getString();
            final List<? extends ColumnProjector> projectedColumns = queryPlan.getProjector().getColumnProjectors();
            final List<String> columns = Lists.transform(projectedColumns,
View Full Code Here

    Connection connection = null;
    List<ColumnInfo> columnInfos = null;
        try {
            connection = this.phoenixConfiguration.getConnection();
            final Statement  statement = connection.createStatement();
            final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
            final QueryPlan queryPlan = pstmt.compileQuery(sqlQuery);
            final List<? extends ColumnProjector> projectedColumns = queryPlan.getProjector().getColumnProjectors();
            columnInfos = Lists.newArrayListWithCapacity(projectedColumns.size());
            columnInfos = Lists.transform(projectedColumns, new Function<ColumnProjector,ColumnInfo>() {
              @Override
View Full Code Here

            try{
                final Connection connection = getConnection();
                final String selectStatement = getConf().getSelectStatement();
                Preconditions.checkNotNull(selectStatement);
                final Statement statement = connection.createStatement();
                final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
                this.queryPlan = pstmt.compileQuery(selectStatement);
            } catch(Exception exception) {
                LOG.error(String.format("Failed to get the query plan with error [%s]",exception.getMessage()));
                throw new RuntimeException(exception);
            }
View Full Code Here

        String query = "select count(*) from start_stop_test where pk >= 'EA' and pk < 'EZ'";
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2));
        conn = DriverManager.getConnection(getUrl(), props);
        Statement statement = conn.createStatement();
        statement.execute(query);
        PhoenixStatement pstatement = statement.unwrap(PhoenixStatement.class);
        List<KeyRange>splits = pstatement.getQueryPlan().getSplits();
        assertTrue(splits.size() > 0);
    }
   
    @Test
View Full Code Here

    public void statement_bad_wrapper_02() throws SQLException {
        JenaConnection conn = this.getConnection();
        Statement stmt = conn.createStatement();

        try {
            stmt.unwrap(JenaStatement.class);
        } finally {
            stmt.close();
            conn.close();
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.