qdb_getdbsize()

Return the size of a database

Synopsis:

#include <qdb/qdb.h>

int qdb_getdbsize( qdb_hdt_t    *hdl,
                   int           scope,
                   uint32_t     *page_size,
                   uint32_t     *total_pages,
                   uint32_t     *free_pages );

Arguments:

hdl
A pointer to the database handle.
scope
Describes the scope of the operation. See the description of the scope argument to qdb_backup() for more information.
page_size
A pointer to a location where the function stores the size (in bytes) of a page in the database file.
total_pages
A pointer to a location where the function stores the number of pages in the database file.
free_pages
A pointer to a location where the function stores the number of pages that aren't being used to store data.

Library:

qdb

Description:

This function fills in arguments with information about the size (in bytes) of the database file associated with the database handle hdl. The size of the database on the filesystem is page_size × total_pages.

If you vacuum the database, qdb gets rid of the free pages so that the total pages goes down, free pages goes to 0, and the database file size becomes smaller. For more information, see the VACUUM SQL command, qdb_vacuum() function, and the auto_vacuum section of the PRAGMA command.


Note: For a database to be included in the size count for a database handle, the Size Attached option for that database file must be set to TRUE in the QDB configuration file.

Returns:

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

Classification:

QNX Neutrino

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

qdb_vacuum(), PRAGMA, VACUUM