qdb_getdbsize_bytes()

Updated: April 19, 2023

Return size information for a database, based on the total bytes used and total bytes free

Synopsis:

#include <qdb/qdb.h>

int qdb_getdbsize_bytes( qdb_hdl_t *db,
                         int scope,
                         uint64_t *bytes_total,
                         uint64_t *bytes_free );

Arguments:

db
A pointer to the database handle.
scope
The scope of the operation; see the scope argument in qdb_backup() for more information.
bytes_total
A pointer to memory for storing the total size (in bytes) of the database file.
bytes_free
A pointer to memory for storing the total free space (in bytes) in the database file.

Library:

qdb

Description:

This function provides information about the size of the database associated with the db handle. The information reported includes the total size of the database file (in bytes); this size includes the free pages, which are pages that don't currently store any data. The function also reports the total number of bytes contained in those free pages.

If you vacuum the database, QDB deletes the free pages so the total size of the database file decreases and the number of free bytes goes to 0. For more information, see the VACUUM SQL command, the qdb_vacuum() function, and the Auto-vacuum section of the PRAGMA command.

Note: For an attached database to be included in the size calculation of the main database (i.e., the one with handle db), the attached database must be listed under the SizeAttached option in the configuration object for the main database.

Returns:

0
Success.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes