MCPcopy Create free account
hub / github.com/BaseXdb/basex / run

Method run

basex-core/src/main/java/org/basex/core/cmd/DropDB.java:27–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 9

validPatternMethod · 0.95
dropMethod · 0.95
infoMethod · 0.65
closeMethod · 0.65
errorMethod · 0.45
listMethod · 0.45
userMethod · 0.45
isEmptyMethod · 0.45
pinnedMethod · 0.45

Tested by

no test coverage detected