Result run(DbInterface db) throws Exception {
  try {
switch (type) {
case CONNECT:
      db.connect();
    result=new Result("connect");
  break;
case RESET:
db.reset();
result=new Result("reset");
break;
case DISCONNECT:
db.disconnect();
result=new Result("disconnect");
break;
case END:
db.end();
result=new Result("disconnect");
break;
case CREATE_TABLE:
db.createTable(table);
result=new Result("createTable");
break;
case DROP_TABLE:
db.dropTable(table);
result=new Result("dropTable");
break;
case CREATE_INDEX:
db.createIndex(index);
result=new Result("createIndex");
break;
case DROP_INDEX:
db.dropIndex(index);
result=new Result("dropIndex");
break;
case INSERT:
result=db.insert(table,columns,values);
break;
case SELECT:
result=select(db);
break;
case DELETE:
result=db.delete(table,condition);
break;
case UPDATE:
result=db.update(table,columns,values,condition);
break;
case AUTOCOMMIT_ON:
db.setAutoCommit(true);
result=new Result("setAutoCommit true");
break;
case AUTOCOMMIT_OFF:
db.setAutoCommit(false);
result=new Result("setAutoCommit false");
break;
case COMMIT:
db.commit();
result=new Result("commit");
break;
case ROLLBACK:
db.rollback();
result=new Result("rollback");
break;
default :
throw new AssertionError("type=" + type);
}
}
 catch (SQLException e) {
result=new Result("",e);
}
return result;
}

Result run ( DbInterface db ) throws Exception { try { switch ( type ) { case CONNECT : db . connect ( ) ; result = new Result ( "connect" ) ; break ; case RESET : db . reset ( ) ; result = new Result ( "reset" ) ; break ; case DISCONNECT : db . disconnect ( ) ; result = new Result ( "disconnect" ) ; break ; case END : db . end ( ) ; result = new Result ( "disconnect" ) ; break ; case CREATE_TABLE : db . createTable ( table ) ; result = new Result ( "createTable" ) ; break ; case DROP_TABLE : db . dropTable ( table ) ; result = new Result ( "dropTable" ) ; break ; case CREATE_INDEX : db . createIndex ( index ) ; result = new Result ( "createIndex" ) ; break ; case DROP_INDEX : db . dropIndex ( index ) ; result = new Result ( "dropIndex" ) ; break ; case INSERT : result = db . insert ( table , columns , values ) ; break ; case SELECT : result = select ( db ) ; break ; case DELETE : result = db . delete ( table , condition ) ; break ; case UPDATE : result = db . update ( table , columns , values , condition ) ; break ; case AUTOCOMMIT_ON : db . setAutoCommit ( true ) ; result = new Result ( "setAutoCommit true" ) ; break ; case AUTOCOMMIT_OFF : db . setAutoCommit ( false ) ; result = new Result ( "setAutoCommit false" ) ; break ; case COMMIT : db . commit ( ) ; result = new Result ( "commit" ) ; break ; case ROLLBACK : db . rollback ( ) ; result = new Result ( "rollback" ) ; break ; default : throw new AssertionError ( "type=" + type ) ; } } catch ( SQLException e ) { result = new Result ( "" , e ) ; } return result ; }
run the command against the specified database .
