@page
@section @code{DB->open}
@setfilename tokudb
@settitle DB->open

@c man title db_open tokudb
@unnumberedsubsec Synopsis
@c man begin SYNOPSIS
@code{#include <db.h>}

@noindent
@code{int DB->open(DB *}@var{db}@code{, DB_TXN *}@var{txnid}@code{, const char *}@var{file}@code{, const char *}@var{database}@code{, DBTYPE }@var{type}@code{, u_int32_t }@var{flags}@code{, int }@var{mode}@code{);}

@c this works for latex (sort of) but not for texi2pod.  It doesn't really work for latex either:
@c @multitable {@code{int DB->open(}} {for column two asdfasdfasdf}
@c @item @code{int DB->open(}
@c @tab                     @code{DB *}@var{db}@code{,}
@c @item @tie{}
@c @tab                     @code{DB_TXN *}@var{txnid}@code{,}
@c @item @tie{}
@c @tab                     @code{const char *}@var{file}@code{,}
@c @item @tie{}
@c @tab                     @code{const char *}@var{database}@code{,}
@c @item @tie{}
@c @tab                     @code{DBTYPE }@var{type}@code{,}
@c @item }
@c @tab                     @code{u_int32_t }@var{flags}@code{,}
@c @item 
@c @tab                     @code{int }@var{mode}@code{);}
@c @end multitable

@c man end

@unnumberedsubsec Description
@c man begin DESCRIPTION

@code{DB->open} opens the database named by
@var{file}
and
@var{database.}

The database is opened read/write.

The @code{DB->open} operation is expensive.  If possible, open a
database once, and reuse the @code{DB} handle for many operations.

TokuDB supports at most a few thousand databases per file.
@c man end

@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item db
A unopened @code{DB} handle that was created using @code{db_create()}.
@item txnid
Either @code{NULL} or a @code{TXNID}.
@item file
The name of the file that holds the database.  

The @var{file} must be non-@code{NULL}.  TokuDB does not currently support in-memory databases.
@item database
If @code{NULL} then the file contains only one unnamed database.
Otherwise @var{database} specifies the name of a database, stored
within the file, to open.
@item type
must be set to @code{DB_BTREE}.  (TokuDB supports only dictionaries, not hash tables or queues.)
@item flags
must be zero or the bitwise-or of one or more of the following values:
@table @code
@item DB_CREATE
Create the database if it does not exist.  If the database does not
already exist and @code{DB_CREATE} is not specified, then the
@code{DB->open} will fail.
@end table

@item mode
The mode (see @code{chmod(2)}) modified by the @code{umask(2)}, used when a file is created.
@end table
@c man end

@unnumberedsubsec Return Value
@c man begin RETURNVALUE
Returns zero on success.  The following non-zero errors can be returned:
@table @code
@item DB_DEADLOCK
The system discovered deadlock cycle involving this and other transactions.
This operation was killed.
@item DB_LOCK_NOTGRANTED
In an environment configured for lock timeouts, the system was unable to grant a lock within the allowed time.
@item ENOENT
The file or directory does not exist.
@item EINVAL
You passed invalid parameters to this operation.  
@end table

@c man end

@include everyman.texi

