/** Registers a shutdown and return's the shutdown query. If this is
* the fifth shutdown, then the database is compacted.
* @return The shutdown SQL. */
private static String registerShutdown()
{
UserSettingsManager settings = UserSettingsManager.getInstance();
try
{
String command = "SHUTDOWN";
String compactCommand = " COMPACT";
String curr = settings.get("SHUTDOWN");
boolean fifthShutdown = curr == null ? false : curr.equals("5");
return fifthShutdown ? command + compactCommand : command;
}
finally
{