Extract the data source for a database
Synopsis:
#include <qdb/qdb.h>
int qdb_data_source( qdb_hdl_t *db,
char *buffer,
int buffer_length );
Arguments:
- db
- A pointer to the database handle.
- buffer
- A buffer to hold the resulting source path information.
Set to NULL to have the required buffer size returned by the function.
The buffer is managed by the client application, not by QDB.
- buffer_length
- The length of buffer; this argument is relevant only when the buffer is not
NULL.
Description:
This function provides a description of the source used to initialize the database. This
source may be one of several paths, or a list of the schema creation and data population files,
depending on the state of the specified database when qdb is started and how the database is initialized:
- If the database is empty, the string will be empty.
- If the database is created with a schema only, the string will be the path to the schema file used to create the database.
- If the database is created with a schema and initialized with a data schema, then the string
will be a colon-delimited list of schema:data
schema1[:data schema2...]
- If the database is created from an existing database that is not corrupted (and not a backup database), then the string will
be the path to that database, which will be the same as the Filename entry.
- If the database is created from a backup database, then the string will be the path to the restoring database from one of
the BackupDir entries.
If you're unsure of the necessary size of the buffer to hold the data source string, call qdb_data_source() with buffer set to NULL
and use the function's return value for the amount of memory to allocate for the buffer.
Then, call qdb_data_source() again, passing in the address of the created buffer in buffer, to get the data source.
Returns:
- >-1
- Depending on the arguments, either the required size of the buffer to store the data source
or the length of the string stored in buffer (both size values include the zero-terminator).
See Description for more information.
- -1
- An error occurred (errno is set).
Classification:
QNX Neutrino
Safety: |
|
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |