| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | protected boolean run() { |
| 29 | final String pattern = args[0]; |
| 30 | if(!Databases.validPattern(pattern)) return error(NAME_INVALID_X, pattern); |
| 31 | |
| 32 | // retrieve all databases; return true if no database is found (no error) |
| 33 | final StringList dbs = context.databases.list(context.user(), pattern); |
| 34 | if(dbs.isEmpty()) return info(NO_DB_DROPPED); |
| 35 | |
| 36 | // loop through all databases |
| 37 | boolean ok = true; |
| 38 | for(final String db : dbs) { |
| 39 | // close database if it's currently opened |
| 40 | close(context, db); |
| 41 | // check if database is still pinned |
| 42 | if(context.pinned(db)) { |
| 43 | info(DB_PINNED_X, db); |
| 44 | ok = false; |
| 45 | } else if(!drop(db, soptions)) { |
| 46 | // dropping was not successful |
| 47 | info(DB_NOT_DROPPED_X, db); |
| 48 | ok = false; |
| 49 | } else { |
| 50 | info(DB_DROPPED_X, db); |
| 51 | } |
| 52 | } |
| 53 | return ok; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Deletes the specified database. Calls for main-memory database instances are ignored. |