Extract the data source for a database
Synopsis:
#include <qdb/qdb.h>
int qdb_data_source( qdb_hdl_t *hdl, char *buffer, int buflen );
Arguments:
- hdl
- A pointer to the database handle.
- buffer
- A buffer to hold the resulting source path information. You can set this
parameter to NULL to make the function return the required
buffer size. The buffer memory is managed by the client application, not
QDB.
- buflen
- The length of buffer; this argument is relevant only when
that parameter is not NULL.
Library:
qdb
Description:
This function fills in a string to describe the data 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 on 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 one or more data schemas, 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 neither corrupted
nor a backup database, 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, the string will be the path
to the restoring database from one of the BackupDir entries.
If you don't know the buffer size required 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 the function again, passing in the address
and length of the created buffer, to get the data source.
Returns:
- >=0
- Depending on the arguments, either the buffer size required for storing
the data source or the length of the string stored in
buffer (both size values include the
null-terminator).
- -1
- An error occurred (errno is set).
Classification:
QNX Neutrino
Safety: |
|
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |