| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | protected boolean run() { |
| 40 | final String db = args[0]; |
| 41 | if(!Databases.validName(db)) return error(NAME_INVALID_X, db); |
| 42 | |
| 43 | // check if database is already opened |
| 44 | Data data = context.data(); |
| 45 | if(data == null || !data.meta.name.equals(db)) { |
| 46 | Close.close(context); |
| 47 | try { |
| 48 | data = open(db, context, options, true, true); |
| 49 | context.openDB(data); |
| 50 | |
| 51 | final String path = args[1]; |
| 52 | if(!path.isEmpty()) { |
| 53 | context.current(new DBNodes(data, data.resources.docs(path).toArray())); |
| 54 | } |
| 55 | if(data.meta.oldindex()) info(H_INDEX_FORMAT); |
| 56 | if(data.meta.corrupt) info(DB_CORRUPT); |
| 57 | } catch(final IOException ex) { |
| 58 | return error(Util.message(ex)); |
| 59 | } |
| 60 | } |
| 61 | return info(DB_OPENED_X, db, jc().performance); |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public void addLocks() { |