1 21 22 package org.dbunit.database.statement; 23 24 import java.sql.Connection ; 25 import java.sql.SQLException ; 26 27 32 public class CompoundStatement extends AbstractBatchStatement 33 { 34 private StringBuffer _buffer = new StringBuffer (); 35 36 CompoundStatement(Connection connection) throws SQLException 37 { 38 super(connection); 39 } 40 41 public void addBatch(String sql) throws SQLException 42 { 43 _buffer.append(sql); 44 _buffer.append(";"); 45 } 46 47 public int executeBatch() throws SQLException 48 { 49 return _statement.executeUpdate(_buffer.toString()); 50 } 51 52 public void clearBatch() throws SQLException 53 { 54 _buffer = new StringBuffer (); 55 } 56 } 57 58 59 60 61 62 | Popular Tags |