@section @code{db_create}
@setfilename tokudb
@settitle db_create

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

@noindent
@code{int db_create(DB **}@var{dbp}@code{, DB_ENV *}@var{env}@code{, u_int32_t }@var{flags}@code{);}
@c man end
@unnumberedsubsec Description
@c man begin DESCRIPTION
@code{db_create} creates a @code{DB} handle, allocating memory and initializing its contents.

After creating the handle, you open a database using @code{(*}@var{dbp}@code{)->open(...)}.

To free the memory associated with the handle call @code{(*}@var{dbp}@code{)->close(...)}
(or @code{->remove} or @code{->rename} or @code{->verify\}when those are ready).

The handle contains a field called @code{app_private} which is declared
as type @code{void*}.  This field is provided for the use of the
application and is not further used by TokuDB.  One typical use of
@code{app_private} is to pass information about the database to a
user-defined sort-order function.
@c man end
@unnumberedsubsec Parameters
@c man begin PARAMETERS
@table @var
@item dbp
A pointer to a @code{DB} variable.  The @code{db_create} function does something like @code{*}@var{dbp}@code{=malloc(...)}.

@item env
If @var{env}@code{==NULL} then the database is not part of an environment
(hence it has no transactions, locking, or recovery).

Otherwise the database is created within the specified environment,
and inherits the properties of that environment.  (For example if
logging for recovery is enabled by the environment, then the database
will have logging too.)

@item flags
The @var{flags} parameter must be set to 0.

@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 EINVAL
You passed invalid parameters to this operation.
@end table
@c man end

@unnumberedsubsec Notes
@c man begin NOTES
TokuDB allows at most a few thousand databases per file.
@c man end

@include everyman.texi


