@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) { } } } } }
public void addBatch(String sql) throws SQLException { checkClosed(); if (batchedArgs == null) { batchedArgs = new LinkedList<String>(); } if (sql != null) { batchedArgs.add(sql); } }
TGroupStatement implements TStatement { public void addBatch(String sql) throws SQLException { checkClosed(); if (batchedArgs == null) { batchedArgs = new LinkedList<String>(); } if (sql != null) { batchedArgs.add(sql); } } }
TGroupStatement implements TStatement { 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); }
TGroupStatement implements TStatement { 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); boolean execute(String sql); boolean execute(String sql, int autoGeneratedKeys); boolean execute(String sql, int[] columnIndexes); boolean execute(String sql, String[] columnNames); int executeUpdate(String sql); int executeUpdate(String sql, int autoGeneratedKeys); int executeUpdate(String sql, int[] columnIndexes); int executeUpdate(String sql, String[] columnNames); void addBatch(String sql); void clearBatch(); int[] executeBatch(); void close(); ResultSet executeQuery(String sql); SQLWarning getWarnings(); void clearWarnings(); boolean getMoreResults(); int getQueryTimeout(); void setQueryTimeout(int queryTimeout); ResultSet getResultSet(); int getUpdateCount(); int getResultSetConcurrency(); int getResultSetHoldability(); int getResultSetType(); void setResultSetType(int resultSetType); void setResultSetConcurrency(int resultSetConcurrency); void setResultSetHoldability(int resultSetHoldability); Connection getConnection(); void cancel(); int getFetchDirection(); int getFetchSize(); int getMaxFieldSize(); int getMaxRows(); void setCursorName(String cursorName); void setEscapeProcessing(boolean escapeProcessing); boolean getMoreResults(int current); void setFetchDirection(int fetchDirection); void setFetchSize(int fetchSize); void setMaxFieldSize(int maxFieldSize); void setMaxRows(int maxRows); ResultSet getGeneratedKeys(); boolean isWrapperFor(Class<?> iface); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isClosed(); void setPoolable(boolean poolable); boolean isPoolable(); @Override void fillMetaData(SqlMetaData sqlMetaData); @Override SqlMetaData getSqlMetaData(); }
TGroupStatement implements TStatement { 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); boolean execute(String sql); boolean execute(String sql, int autoGeneratedKeys); boolean execute(String sql, int[] columnIndexes); boolean execute(String sql, String[] columnNames); int executeUpdate(String sql); int executeUpdate(String sql, int autoGeneratedKeys); int executeUpdate(String sql, int[] columnIndexes); int executeUpdate(String sql, String[] columnNames); void addBatch(String sql); void clearBatch(); int[] executeBatch(); void close(); ResultSet executeQuery(String sql); SQLWarning getWarnings(); void clearWarnings(); boolean getMoreResults(); int getQueryTimeout(); void setQueryTimeout(int queryTimeout); ResultSet getResultSet(); int getUpdateCount(); int getResultSetConcurrency(); int getResultSetHoldability(); int getResultSetType(); void setResultSetType(int resultSetType); void setResultSetConcurrency(int resultSetConcurrency); void setResultSetHoldability(int resultSetHoldability); Connection getConnection(); void cancel(); int getFetchDirection(); int getFetchSize(); int getMaxFieldSize(); int getMaxRows(); void setCursorName(String cursorName); void setEscapeProcessing(boolean escapeProcessing); boolean getMoreResults(int current); void setFetchDirection(int fetchDirection); void setFetchSize(int fetchSize); void setMaxFieldSize(int maxFieldSize); void setMaxRows(int maxRows); ResultSet getGeneratedKeys(); boolean isWrapperFor(Class<?> iface); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isClosed(); void setPoolable(boolean poolable); boolean isPoolable(); @Override void fillMetaData(SqlMetaData sqlMetaData); @Override SqlMetaData getSqlMetaData();  }