compactWithOptions (NotesDatabase - JavaScript)

Compacts a local database allowing the submission of options.

Defined in

NotesDatabase

Syntax

compactWithOptions(options:string) : int

compactWithOptions(options:int) : int

compactWithOptions(options:int, spacethreshhold:string) : int

Parameter Description
options:string One or more command-line options supported by the Compact server task without the minus signs. Spaces are insignificant except that a space cannot be placed in the S option between the number and the final K, k, M, or m. Options are processed in their order of specification. See below for the list.
options:int One or more of the following constants. Combine constants by adding.
  • NotesDatabase.CMPC_ARCHIVE_DELETE_COMPACT 1 a (archive and delete, then compact)
  • NotesDatabase.CMPC_ARCHIVE_DELETE_ONLY 2 A (archive and delete with no compact; supersedesa)
  • NotesDatabase.CMPC_RECOVER_REDUCE_INPLACE 4 b (recover unused space in place without reducing file size)
  • NotesDatabase.CMPC_RECOVER_INPLACE 8 B (recover unused space in place and reduce file size; supersedes b)
  • Database.CMPC_COPYSTYLE 16 c and C (copy style; supersedes b and B)
  • NotesDatabase.CMPC_DISCARD_VIEW_INDICES 32 d and D (discard view indexes)
  • NotesDatabase.CMPC_ENABLE_DOCTBLBIT_OPTMZN 64 F (enable document table bit map optimization; supersedes f)
  • NotesDatabase.CMPC_DISABLE_DOCTBLBIT_OPTMZN 128 f (disable document table bit map optimization)
  • NotesDatabase.CMPC_ENABLE_RESPONSE_INFO 256 h (enable "Don't support specialized response hierarchy"; supersedes H)
  • NotesDatabase.CMPC_DISABLE_RESPONSE_INFO 512 H (disable "Don't support specialized response hierarchy")
  • NotesDatabase.CMPC_IGNORE_COPYSTYLE_ERRORS 1024 i (ignore copy-style errors)
  • NotesDatabase.CMPC_ENABLE_LARGE_UNKTBL 2048 K (enable large unknown table; supersedes k)
  • NotesDatabase.CMPC_DISABLE_LARGE_UNKTBL 4096 k (disable large unknown table)
  • NotesDatabase.CMPC_NO_LOCKOUT 8192 l and L (do not lock out users)
  • Database.CMPC_MAX_4GB 16384 m and M (set maximum database size at 4 gigabytes)
  • NotesDatabase.CMPC_CHK_OVERLAP 32768 o and O (check overlap)
  • NotesDatabase.CMPC_REVERT_FILEFORMAT 65536 r and R (do not convert old file format)
  • NotesDatabase.CMPC_ENABLE_TRANSACTIONLOGGING 131072 T (enable transaction logging; supersedes t)
  • NotesDatabase.CMPC_DISABLE_TRANSACTIONLOGGING 262144 t (disable transaction logging)
  • NotesDatabase.CMPC_ENABLE_UNREAD_MARKS 524288 u (enable "Don't maintain unread marks"; supersedes U)
  • NotesDatabase.CMPC_DISABLE_UNREAD_MARKS 1048576 U (disable "Don't maintain unread marks")
spacethreshhold The value of the S option (compact if specified percent or amount of unused space) without the c, for example, "10" for 10 percent, "10K" for 10 kilobytes, or "10M" for 10 megabytes.
Return value Description
int The difference in bytes between the size of the database before and after compacting.

Usage

This method throws an exception if the database is not local.

You cannot compact the current database (the database in which the agent is running) or the desktop.dsk file.

The options are those that you can use with the Compact server task. For more information, see "Compact options" in Administration Help.

This method does not support the e or E option.

Examples

This button compacts a database using the options b, L, and S10.
var dbname:string = requestScope.filename;
var db:NotesDatabase = session.getDatabase("", dbname, false);
if (db == null) {
	requestScope.status = "Cannot open database " + dbname;
	return;
}
var title:string = db.getTitle();
var delta:int = db.compactWithOptions("bLS10");
requestScope.status = "Compacting database '" + title + "'\n";
requestScope.status += "Size difference in bytes: " + delta;
This button compacts a database using the same options.
var dbname:string = requestScope.filename;
var db:NotesDatabase = session.getDatabase("", dbname, false);
if (db == null) {
	requestScope.status = "Cannot open database " + dbname;
	return;
}
var title:string = db.getTitle();
var options:int = NotesDatabase.CMPC_RECOVER_REDUCE_INPLACE + NotesDatabase.CMPC_NO_LOCKOUT;
var delta:int = db.compactWithOptions(options, "10");
requestScope.status = "Compacting database '" + title + "'\n";
requestScope.status += "Size difference in bytes: " + delta;