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

Method run

basex-core/src/main/java/org/basex/core/cmd/AlterDB.java:29–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 }
28
29 @Override
30 protected boolean run() {
31 final String src = args[0];
32 final String trg = args[1];
33 // check if names are valid
34 if(!Databases.validName(src)) return error(NAME_INVALID_X, src);
35 if(!Databases.validName(trg)) return error(NAME_INVALID_X, trg);
36
37 // database does not exist
38 if(!soptions.dbExists(src)) return error(DB_NOT_FOUND_X, src);
39
40 // close database if it's currently opened and not opened by others
41 if(!closed) closed = close(context, src);
42 // check if source database is still opened
43 if(context.pinned(src)) return error(DB_PINNED_X, src);
44
45 // try to alter database
46 return alter(src, trg, soptions) && (!closed || new Open(trg).run(context)) ?
47 info(DB_RENAMED_X, src, trg) : error(DB_NOT_RENAMED_X, src);
48 }
49
50 @Override
51 public void addLocks() {

Callers

nothing calls this directly

Calls 8

validNameMethod · 0.95
alterMethod · 0.95
closeMethod · 0.65
runMethod · 0.65
infoMethod · 0.65
errorMethod · 0.45
dbExistsMethod · 0.45
pinnedMethod · 0.45

Tested by

no test coverage detected