compactWithOptions (NotesDatabase - JavaScript™)
Compacts a local database allowing the submission of options.
Defined in
NotesDatabaseSyntax
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.
|
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 optionsb
, 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;