Compared to deleting all the records in a database individually, {@code truncateDatabase} is a very efficient operation. Some internalhousekeeping information is updated, but the database records are not read or written, and very little I/O is needed.
When called on a database configured with secondary indices, the application is responsible for also truncating all associated secondary indices. To guarantee integrity, a primary database and all of its secondary databases should be truncated atomically using a single transaction.
Applications should not truncate a database with open {@link Database Database} handles. If the database is open with the same transaction aspassed in the {@code txn} parameter, {@link IllegalStateException} isthrown by this method. If the database is open using a different transaction, this method will block until all database handles are closed, or until the conflict is resolved by throwing {@link LockConflictException}.
@param txn For a transactional environment, an explicit transaction maybe specified or null may be specified to use auto-commit. For a non-transactional environment, null must be specified. @param databaseName The database to be truncated. @param returnCount If true, count and return the number of recordsdiscarded. @return The number of records discarded, or -1 if returnCount is false. @throws DatabaseNotFoundException if the database does not exist. @throws OperationFailureException if one of the
|
|