Package java.sql

Examples of java.sql.CallableStatement.executeQuery()


      conn = dataSource.getConnection();
      stmt = conn.prepareCall("call reduceTag(?,?)");
      for(Tag t : tags){
        stmt.setInt(1,t.getId());
        stmt.setInt(2,user.getId());
        rs = stmt.executeQuery();
      }     
      while(rs.next()){
        Bookmark bm = BookmarkDBDao.createBookmarkObject2(rs);
        changeBookmarks.add(bm);
      }
View Full Code Here


      stmt = conn.prepareCall("call pageLinkTagSortByFreq(?,?,?,?)");
      stmt.setInt(1,link.getId());
      stmt.setInt(2,offset);
      stmt.setInt(3,count);
      stmt.registerOutParameter(4,Types.INTEGER);
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        LinkTag linktag =createLinkTagObject(rs);
        tags.add(linktag);
        logger.debug("found: " + linktag);
      }
View Full Code Here

    //create a callable statement with hold cursor over commit using reflection.
    Method sh = conn.getClass().getMethod("prepareCall", PREP_STMT_PARAM);
    cs = (CallableStatement) (sh.invoke(conn, PREP_STMT_ARG));
    cs.setInt(1,1);
    rs = cs.executeQuery();

    System.out.println("do next() before commit");
    rs.next();
    System.out.println("look at first column's value: " + rs.getInt(1));
    conn.commit();
View Full Code Here

    {
        CallableStatement cs =
            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
        cs.setInt(1, 0);
        try {
            cs.executeQuery();
            fail("executeQuery() didn't fail.");
        } catch (SQLException sqle) {
            assertNoResultSetFromExecuteQuery(sqle);
        }
    }
View Full Code Here

        throws SQLException
    {
        CallableStatement cs =
            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
        cs.setInt(1, 1);
        ResultSet rs = cs.executeQuery();
        assertNotNull("executeQuery() returned null.", rs);
        assertTrue("Result set has no data.", rs.next());
        rs.close();
        cs.close();
    }
View Full Code Here

    {
        CallableStatement cs =
            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
        cs.setInt(1, 2);
        try {
            cs.executeQuery();
            fail("executeQuery() didn't fail.");
        } catch (SQLException sqle) {
            assertMultipleResultsFromExecuteQuery(sqle);
        }
    }
View Full Code Here

        }
        System.out.println("Stats:"+stats);
       
        for (int i=0; i<count; i++) {
            CallableStatement st = con.prepareCall(slowSql);
            ResultSet rs = st.executeQuery();
            rs.close();
            st.close();
        }
        System.out.println("Stats:"+stats);
        ConnectionPool pool = datasource.getPool();
View Full Code Here

        }
        System.out.println("Stats:"+stats);
       
        for (int i=0; i<count; i++) {
            CallableStatement st = con.prepareCall(slowSql);
            ResultSet rs = st.executeQuery();
            rs.close();
            st.close();
        }
        System.out.println("Stats:"+stats);
        assertEquals("Expecting to have received "+(2*count)+" notifications.",2*count, listener.notificationCount);
View Full Code Here

        res = statement.executeQuery(translatedQuery);
      }
      else
      {
        final PreparedStatement pstmt = (PreparedStatement) statement;
        res = pstmt.executeQuery();
      }
    }
    finally
    {
      currentRunningStatement = null;
View Full Code Here

            ResultSet rs = c.getResultSet();

            rs.next();
            assertEquals(value, 2);

            rs = c.executeQuery();

            rs.next();
            assertEquals(value, 2);
        } catch (Exception e) {
            assertTrue("unexpected error", false);
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.