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 that determine the connection properties. This argument can be 0 (no flags) or a combination of:
QDB_CONN_DFLT_SHARE
Use the default sharing policy for the database connection (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 in asynchronous mode. In this mode, qdb_statement() may return before the statement has finished executing against the database.

Library:

qdb

Description:

This function connects to the specified database and sets properties of the database connection. When successful, the function returns a pointer to a handle for the new connection. You need to call qdb_connect() for every database or every concurrent access to one database.

Note: Two threads can share the same database connection, provided that they coordinate between themselves. Or, each thread can call this function to obtain its own connection.

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

Returns:

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

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes