DB->truncate API Ref

#include <db.h>

int DB->truncate(DB *db, DB_TXN *txnid, u_int32_t *countp, u_int32_t flags);


Description: DB->truncate

The DB->truncate method empties the database, discarding all records it contains. The number of records discarded from the database is returned in countp.

When called on a database configured with secondary indices using the DB->associate method, the DB->truncate method truncates the primary database and all secondary indices. A count of the records discarded from the primary database is returned.

It is an error to call the DB->truncate method on a database with open cursors.

The DB->truncate method returns a non-zero error value on failure and 0 on success.

Parameters
countp flags txnid

Errors

The DB->truncate method may fail and return one of the following non-zero errors:


DB_LOCK_DEADLOCK DB_LOCK_NOTGRANTED

EINVAL


Class DB
See Also Databases and Related Methods

APIRef

Copyright (c) 1996,2008 Oracle. All rights reserved.