qdb_connect()

Connect to a database

Synopsis:

#include <qdb/qdb.h>

qdb_hdl_t *qdb_connect( const char *dbname,
                        int flags );

Arguments:

dbname
The database device name (e.g., /dev/qdb/customerdb).
flags
Flags for determining parameters of the connection. This argument can be 0 (no flags) or a combination of:
QDB_CONN_DFLT_SHARE
Use the default database connection share mode (as given in the -C command-line option to QDB). Without this flag, a private connection is forced.
QDB_CONN_NONBLOCKING
If this flag is set, qdb_statement() fails and returns immediately (setting errno to EBUSY) if the database file is locked. By default, qdb_statement() waits for at least the busy timeout period (set using qdb_setbusytimeout()) if the database is locked, before returning with a failure result.
Setting this flag also makes subsequent calls to qdb_connect() nonblocking (as if the -T command-line option were 0).
QDB_CONN_STMT_ASYNC
Execute statements asynchronously. In this mode, qdb_statement() may return before the statement has finished executing against the database (see "Using asynchronous mode").

Library:

qdb

Description:

This function connects to the database specified by dbname and sets parameters for the database connection. When successful, the function returns a pointer to a handle for the new connection. You need to call this function for every database or for concurrent access to one database.

Note: Two threads can share the same database connection, provided that they coordinate between themselves. Alternatively, each thread can call qdb_connect() and have its own connection.

You should terminate all connections by calling qdb_disconnect() when you're finished using them.

Returns:

A valid pointer to an opaque database connection (qdb_hdl_t)
Success.
NULL
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes