Return the size of a database
Synopsis:
#include <qdb/qdb.h>
int qdb_getdbsize( qdb_hdt_t *db,
int scope,
uint32_t *page_size,
uint32_t *total_pages,
uint32_t *free_pages );
Arguments:
- db
- A pointer to the database handle.
- scope
- The scope of the operation. See the description of the scope argument in
qdb_backup() for
more information.
- page_size
- A pointer to a location for storing the size (in bytes) of a page in the database file.
- total_pages
- A pointer to a location for storing the number of pages in the database file.
- free_pages
- A pointer to a location for storing the number of pages not being used to store data.
Description:
This function provides information about the size of the database file associated with the database handle db. The database's size on the filesystem is page_size × total_pages.
If you vacuum the database, QDB deletes the free pages so the total pages goes down, free pages goes to 0, and the database file
becomes smaller. For more information, see the VACUUM SQL command, 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 |