TGroupStatement implements TStatement { @Override public void addBatch(String sql) throws SQLException { checkClosed(); if (batchedArgs == null) { batchedArgs = new LinkedList<String>(); } if (sql != null) { batchedArgs.add(sql); } } TGroupStatement(TGroupDataSource tGroupDataSource, TGroupConnection tGroupConnection, String appName); @Override boolean execute(String sql); @Override boolean execute(String sql, int autoGeneratedKeys); @Override boolean execute(String sql, int[] columnIndexes); @Override boolean execute(String sql, String[] columnNames); @Override int executeUpdate(String sql); @Override int executeUpdate(String sql, int autoGeneratedKeys); @Override int executeUpdate(String sql, int[] columnIndexes); @Override int executeUpdate(String sql, String[] columnNames); @Override void addBatch(String sql); @Override void clearBatch(); @Override int[] executeBatch(); @Override void close(); @Override ResultSet executeQuery(String sql); @Override SQLWarning getWarnings(); @Override void clearWarnings(); @Override boolean getMoreResults(); @Override int getQueryTimeout(); @Override void setQueryTimeout(int queryTimeout); @Override ResultSet getResultSet(); @Override int getUpdateCount(); @Override int getResultSetConcurrency(); @Override int getResultSetHoldability(); @Override int getResultSetType(); void setResultSetType(int resultSetType); void setResultSetConcurrency(int resultSetConcurrency); void setResultSetHoldability(int resultSetHoldability); @Override Connection getConnection(); @Override void cancel(); @Override int getFetchDirection(); @Override int getFetchSize(); @Override int getMaxFieldSize(); @Override int getMaxRows(); @Override void setCursorName(String cursorName); @Override void setEscapeProcessing(boolean escapeProcessing); @Override boolean getMoreResults(int current); @Override void setFetchDirection(int fetchDirection); @Override void setFetchSize(int fetchSize); @Override void setMaxFieldSize(int maxFieldSize); @Override void setMaxRows(int maxRows); @Override ResultSet getGeneratedKeys(); @Override boolean isWrapperFor(Class<?> iface); @Override @SuppressWarnings("unchecked") T unwrap(Class<T> iface); @Override boolean isClosed(); @Override void setPoolable(boolean poolable); @Override boolean isPoolable(); @Override void setLocalInfileInputStream(InputStream stream); @Override InputStream getLocalInfileInputStream(); @Override String getAppName();  }
@Test public void testAddBatch() throws SQLException { TGroupConnection conn = null; PreparedStatement stat = null; try { conn = tgds.getConnection(); stat = conn.prepareStatement("update test set type=? where id = ?"); stat.setInt(1, 1); stat.setString(2, "2askjfoue33"); stat.addBatch(); stat.setInt(1, 2); stat.setString(2, "retrtorut48"); stat.addBatch(); int[] affectedRow = stat.executeBatch(); System.out.println(Arrays.toString(affectedRow)); MockDataSource.showTrace(); Assert.assertTrue(MockDataSource.hasMethod("db", "db1", "executeBatch")); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) { } if (stat != null) { try { stat.close(); } catch (SQLException e) { } } } } }