1 5 package org.h2.command; 6 7 import java.sql.SQLException ; 8 9 import org.h2.result.LocalResult; 10 import org.h2.util.ObjectArray; 11 12 public class CommandList extends Command { 13 14 private Command command; 15 private String remaining; 16 17 19 public CommandList(Parser parser, Command c, String remaining) { 20 super(parser); 21 this.command = c; 22 this.remaining = remaining; 23 } 24 25 public ObjectArray getParameters() { 26 return command.getParameters(); 27 } 28 29 private void executeRemaining() throws SQLException { 30 Command command = session.prepareLocal(remaining); 31 if(command.isQuery()) { 32 command.query(0); 33 } else { 34 command.update(); 35 } 36 } 37 38 public int update() throws SQLException { 39 int updateCount = command.executeUpdate(); 40 executeRemaining(); 41 return updateCount; 42 } 43 44 public LocalResult query(int maxrows) throws SQLException { 45 LocalResult result = command.query(maxrows); 46 executeRemaining(); 47 return result; 48 } 49 50 public boolean isQuery() { 51 return command.isQuery(); 52 } 53 54 public boolean isTransactional() { 55 return true; 56 } 57 58 public boolean isReadOnly() { 59 return false; 60 } 61 62 } 63 | Popular Tags |