NAME

init_db - open apropos database connection

SYNOPSIS



sqlite3 * init_db(int db_flag)

DESCRIPTION

The init_db() function will try to initialize a connection to man.db which is an Sqlite database and return a pointer to a sqlite3 structure. The connection should subsequentially be closed by calling close_db() which will also release any resources being used by it.

The argument db_flag can be one of the following:

DB_READONLY
This will open the database in read-only mode. Use this when you only want to query the database.

DB_WRITE
This will open the database in read/write mode.

DB_CREATE
This will open the database in read/write mode, and will also create the database schema if it does not exist already.

RETURN VALUES

On successful execution the init_db() function will return a pointer to a sqlite3 structure which represents a connection to the database.

In case the file /var/db/man.db does not exist and DB_CREATE is not used as a value of db_flag, NULL will be returned.

FILES

/var/db/man.db
The Sqlite FTS database which contains an index of the manual pages.

SEE ALSO

apropos-utils(3), close_db(3), run_query(3), run_query_html(3), run_query_pager(3)

AUTHORS

Abhinav Upadhyay

Get NetBSD Summer of Code projects at SourceForge.net. Fast, secure and Free Open Source software downloads
Abhinav Upadhyay <er.abhinav.upadhyay at gmail dot com>
$Id: init_db.html3,v 1.2 2011/08/25 06:52:59 abhinavupadhyay Exp $