Java Code Examples for java.sql.CallableStatement#getWarnings()
The following examples show how to use
java.sql.CallableStatement#getWarnings() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static ResultSet callProcedureByTidList(Connection conn, String sql, int oid, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with oid: " + oid + " and with tid: " + tid ); cs.setInt(1, oid); cs.setInt(2, tid); cs.execute(); ResultSet rs = cs.getResultSet(); if (rs == null) Log.getLogWriter().info("could not get result set"); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 2
Source File: SQLAsyncEventListenerTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected void startAlreadyStartedAsynchEvent(Connection conn, String id) { boolean noWarning = false; boolean noException = false; try { CallableStatement cs1 = conn.prepareCall("CALL SYS.START_ASYNC_EVENT_LISTENER (?)"); cs1.setString(1, id); cs1.execute(); SQLWarning w = cs1.getWarnings(); if (w != null) SQLHelper.printSQLWarning(w); else noWarning = true; noException = true; } catch (SQLException se) { SQLHelper.handleSQLException(se); } if (noWarning && noException) { throw new TestException ("call SYS.START_ASYNC_EVENT_LISTENER on an already" + " started async event listener does not get warning or exception"); } else Log.getLogWriter().info("async eventlistener " + id + " has already been started"); }
Example 3
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static void callProcedureByCidRangePortfolioUpdate(Connection conn, String sql, int cid1, int cid2, BigDecimal subTotal, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " with subTotal: " + subTotal + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setBigDecimal(3, subTotal); cs.setInt(4, tid); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 4
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static Object[] callListStructProcedureByTidList(Connection conn, String proc, int oid, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall("{call " + proc + "(?, ?, ?)}"); cs.registerOutParameter(3, Types.JAVA_OBJECT); cs.setInt(1, oid); cs.setInt(2, tid); cs.execute(); Object[] rs = (Object[])cs.getObject(3); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 5
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static ResultSet callProcedureByTidList(Connection conn, String sql, int oid, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with oid: " + oid + " and with tid: " + tid ); cs.setInt(1, oid); cs.setInt(2, tid); cs.execute(); ResultSet rs = cs.getResultSet(); if (rs == null) Log.getLogWriter().info("could not get result set"); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 6
Source File: GeneralProcedure.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected ResultSet[] callProcedure(Connection conn , Object[] inOut) throws SQLException { ResultSet[] rs = new ResultSet[getOutputResultSetCount()]; CallableStatement cs = null; if (GenericDMLHelper.isDerby(conn)) { cs = getDerbyCallableStatement(conn); } else { cs = getCallableStatement(conn); } cs.execute(); rs = getOutputValues(cs, inOut); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 7
Source File: SQLAsyncEventListenerTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected void startAlreadyStartedAsynchEvent(Connection conn, String id) { boolean noWarning = false; boolean noException = false; try { CallableStatement cs1 = conn.prepareCall("CALL SYS.START_ASYNC_EVENT_LISTENER (?)"); cs1.setString(1, id); cs1.execute(); SQLWarning w = cs1.getWarnings(); if (w != null) SQLHelper.printSQLWarning(w); else noWarning = true; noException = true; } catch (SQLException se) { SQLHelper.handleSQLException(se); } if (noWarning && noException) { throw new TestException ("call SYS.START_ASYNC_EVENT_LISTENER on an already" + " started async event listener does not get warning or exception"); } else Log.getLogWriter().info("async eventlistener " + id + " has already been started"); }
Example 8
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static void callProcedureByCidRangePortfolioUpdate(Connection conn, String sql, int cid1, int cid2, BigDecimal subTotal, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " with subTotal: " + subTotal + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setBigDecimal(3, subTotal); cs.setInt(4, tid); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 9
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected static Object[] callListStructProcedureByTidList(Connection conn, String proc, int oid, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall("{call " + proc + "(?, ?, ?)}"); cs.registerOutParameter(3, Types.JAVA_OBJECT); cs.setInt(1, oid); cs.setInt(2, tid); cs.execute(); Object[] rs = (Object[])cs.getObject(3); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 10
Source File: GeneralProcedure.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
protected ResultSet[] callProcedure(Connection conn , Object[] inOut) throws SQLException { ResultSet[] rs = new ResultSet[getOutputResultSetCount()]; CallableStatement cs = null; if (GenericDMLHelper.isDerby(conn)) { cs = getDerbyCallableStatement(conn); } else { cs = getCallableStatement(conn); } cs.execute(); rs = getOutputValues(cs, inOut); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 11
Source File: SingleTableTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static void callProcedure(Connection conn, String proc, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall("{call " + proc + " ()}"); Log.getLogWriter().info("call " + proc); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 12
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static ResultSet[] callCustomProcedure(Connection conn, String sql, int cid1, int cid2, int tid) throws SQLException { ResultSet[] rs = new ResultSet[3]; CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setInt(3, tid); cs.execute(); rs[0] = cs.getResultSet(); //printMetaData(rs[0]); //Log.getLogWriter().info("custom result set are: \n" +ResultSetHelper.asList(rs[0], false)); if (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { rs[1] = cs.getResultSet(); } if (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { rs[2] = cs.getResultSet(); } SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 13
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static void callProcedureSellordersSGUpdate(Connection conn, String sql, Timestamp orderTime, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with order_time: " + orderTime + " and with tid: " + tid ); cs.setTimestamp(1, orderTime); cs.setInt(2, tid); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 14
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static ResultSet[] callProcedureByCidRangePortfolio(Connection conn, String sql, int cid1, int cid2, int sid, int tid, int[] data) throws SQLException { ResultSet[] rs = new ResultSet[4]; CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " with sid: " + sid + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setInt(3, sid); cs.setInt(4, tid); cs.registerOutParameter(5, Types.INTEGER); cs.execute(); data[0] = new Integer(cs.getInt(5)); rs[0] = cs.getResultSet(); int i=1; while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { Log.getLogWriter().info("has more results"); rs[i] = cs.getResultSet(); i++; } if (rs == null) Log.getLogWriter().info("could not get result sets in callProcedureByCidRangePortfolio"); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 15
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static ResultSet[] callProcedureByCidRangePortfolio(Connection conn, String sql, int cid1, int cid2, int sid, int tid, int[] data) throws SQLException { ResultSet[] rs = new ResultSet[4]; CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " with sid: " + sid + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setInt(3, sid); cs.setInt(4, tid); cs.registerOutParameter(5, Types.INTEGER); cs.execute(); data[0] = new Integer(cs.getInt(5)); rs[0] = cs.getResultSet(); int i=1; while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { Log.getLogWriter().info("has more results"); rs[i] = cs.getResultSet(); i++; } if (rs == null) Log.getLogWriter().info("could not get result sets in callProcedureByCidRangePortfolio"); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 16
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static void callProcedureSellordersSGUpdate(Connection conn, String sql, Timestamp orderTime, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with order_time: " + orderTime + " and with tid: " + tid ); cs.setTimestamp(1, orderTime); cs.setInt(2, tid); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 17
Source File: DAProcedures.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static ResultSet[] callCustomProcedure(Connection conn, String sql, int cid1, int cid2, int tid) throws SQLException { ResultSet[] rs = new ResultSet[3]; CallableStatement cs = null; cs = conn.prepareCall(sql); Log.getLogWriter().info(sql + " with cid1: " + cid1 + " and with cid2: " + cid2 + " and with tid: " + tid ); cs.setInt(1, cid1); cs.setInt(2, cid2); cs.setInt(3, tid); cs.execute(); rs[0] = cs.getResultSet(); //printMetaData(rs[0]); //Log.getLogWriter().info("custom result set are: \n" +ResultSetHelper.asList(rs[0], false)); if (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { rs[1] = cs.getResultSet(); } if (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { rs[2] = cs.getResultSet(); } SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } return rs; }
Example 18
Source File: SingleTableTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static void callProcedure(Connection conn, String proc, int tid) throws SQLException { CallableStatement cs = null; cs = conn.prepareCall("{call " + proc + " ()}"); Log.getLogWriter().info("call " + proc); cs.execute(); SQLWarning warning = cs.getWarnings(); //test to see there is a warning if (warning != null) { SQLHelper.printSQLWarning(warning); } }
Example 19
Source File: SplitRegionRowCountOperationIT.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testSplitAgain() throws Exception { TestConnection conn = spliceClassWatcher.getOrCreateConnection(); CallableStatement callableStatement = conn.prepareCall("call SYSCS_UTIL.SYSCS_SPLIT_TABLE_AT_POINTS(?,?,?)"); callableStatement.setString(1,SCHEMA); callableStatement.setString(2,"A"); callableStatement.setInt(3,12); callableStatement.execute(); SQLWarning warning = callableStatement.getWarnings(); String wm = warning.getMessage(); String ewm = "Ignore splitkey '12' because it is equal to a startkey"; Assert.assertEquals(wm, ewm); }
Example 20
Source File: SWCallableStatementTest.java From skywalking with Apache License 2.0 | 4 votes |
@Test public void testCallableStatementConfig() throws SQLException { CallableStatement callableStatement = swConnection.prepareCall("INSERT INTO test VALUES( ? , ?)", 1, 1); callableStatement.setInt(1, 1); callableStatement.setString(2, "a"); callableStatement.getUpdateCount(); callableStatement.setFetchDirection(1); callableStatement.getFetchDirection(); callableStatement.getResultSetConcurrency(); callableStatement.getResultSetType(); callableStatement.isClosed(); callableStatement.setPoolable(false); callableStatement.isPoolable(); callableStatement.getWarnings(); callableStatement.clearWarnings(); callableStatement.setCursorName("test"); callableStatement.setMaxFieldSize(11); callableStatement.getMaxFieldSize(); callableStatement.setMaxRows(10); callableStatement.getMaxRows(); callableStatement.getParameterMetaData(); callableStatement.setEscapeProcessing(true); callableStatement.setFetchSize(1); callableStatement.getFetchSize(); callableStatement.setQueryTimeout(1); callableStatement.getQueryTimeout(); Connection connection = callableStatement.getConnection(); callableStatement.execute(); callableStatement.getMoreResults(); callableStatement.getMoreResults(1); callableStatement.getResultSetHoldability(); callableStatement.getMetaData(); callableStatement.getResultSet(); callableStatement.close(); verify(mysqlCallableStatement).getUpdateCount(); verify(mysqlCallableStatement).getMoreResults(); verify(mysqlCallableStatement).setFetchDirection(anyInt()); verify(mysqlCallableStatement).getFetchDirection(); verify(mysqlCallableStatement).getResultSetType(); verify(mysqlCallableStatement).isClosed(); verify(mysqlCallableStatement).setPoolable(anyBoolean()); verify(mysqlCallableStatement).getWarnings(); verify(mysqlCallableStatement).clearWarnings(); verify(mysqlCallableStatement).setCursorName(anyString()); verify(mysqlCallableStatement).setMaxFieldSize(anyInt()); verify(mysqlCallableStatement).getMaxFieldSize(); verify(mysqlCallableStatement).setMaxRows(anyInt()); verify(mysqlCallableStatement).getMaxRows(); verify(mysqlCallableStatement).setEscapeProcessing(anyBoolean()); verify(mysqlCallableStatement).getResultSetConcurrency(); verify(mysqlCallableStatement).getResultSetConcurrency(); verify(mysqlCallableStatement).getResultSetType(); verify(mysqlCallableStatement).getMetaData(); verify(mysqlCallableStatement).getParameterMetaData(); verify(mysqlCallableStatement).getMoreResults(anyInt()); verify(mysqlCallableStatement).setFetchSize(anyInt()); verify(mysqlCallableStatement).getFetchSize(); verify(mysqlCallableStatement).getQueryTimeout(); verify(mysqlCallableStatement).setQueryTimeout(anyInt()); verify(mysqlCallableStatement).getResultSet(); assertThat(connection, CoreMatchers.<Connection>is(swConnection)); }