mirror of
https://github.com/berkeleydb/libdb.git
synced 2024-11-16 17:16:25 +00:00
168 lines
6.9 KiB
HTML
168 lines
6.9 KiB
HTML
<!--Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved.-->
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; FreeBSD 2.2.8-19990120-SNAP i386) [Netscape]">
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<H2>
|
|
<A NAME="Compatibility Commands"></A>Compatibility Commands</H2>
|
|
The compatibility commands for old Dbm and Ndbm are described in the <A HREF="../../docs/api_c/dbm.html">dbm</A>
|
|
manpage.
|
|
<P><B>> berkdb dbminit <I>filename</I></B>
|
|
<P>This command will invoke the dbminit function. <B><I>Filename</I></B>
|
|
is used as the name of the database.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb dbmclose</B>
|
|
<P>This command will invoke the dbmclose function.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb fetch <I>key</I></B>
|
|
<P>This command will invoke the fetch function. It will return
|
|
the data associated with the given <B><I>key </I></B>or a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb store <I>key data</I></B>
|
|
<P>This command will invoke the store function. It will store
|
|
the <B><I>key/data</I></B> pair. It will return a 0 on success or
|
|
throw a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb delete <I>key</I></B>
|
|
<P>This command will invoke the deletet function. It will delete
|
|
the <B><I>key</I></B> from the database. It will return a 0 on success
|
|
or throw a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb firstkey</B>
|
|
<P>This command will invoke the firstkey function. It will
|
|
return the first key in the database or a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb nextkey <I>key</I></B>
|
|
<P>This command will invoke the nextkey function. It will return
|
|
the next key after the given <B><I>key</I></B> or a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb hcreate <I>nelem</I></B>
|
|
<P>This command will invoke the hcreate function with <B><I>nelem</I></B>
|
|
elements. It will return a 0 on success or a Tcl error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb hsearch <I>key data action</I></B>
|
|
<P>This command will invoke the hsearch function with <B><I>key</I></B>
|
|
and <B><I>data</I></B>. The <B><I>action</I></B> must be either <B>find</B>
|
|
or <B>enter</B>. If it is <B>find</B>, it will return the resultant
|
|
data. If it is <B>enter</B>, it will return a 0 on success or a Tcl
|
|
error.
|
|
<P>
|
|
<HR WIDTH="100%"><B>> berkdb hdestroy</B>
|
|
<P>This command will invoke the hdestroy function. It will return
|
|
a 0.
|
|
<HR WIDTH="100%"><B>> berkdb ndbm_open [-create] [-rdonly] [-truncate]
|
|
[-mode
|
|
<I>mode</I>] [--] <I>filename</I></B>
|
|
<P>This command will invoke the dbm_open function. After
|
|
it successfully gets a handle to a database, we bind it to a new Tcl command
|
|
of the form <B><I>ndbmX, </I></B>where X is an integer starting at 0 (e.g.
|
|
<B>ndbm0,
|
|
ndbm1, </B>etc). We use the <I>Tcl_CreateObjCommand() </I> to
|
|
create the top level database function. It is through this handle
|
|
that the user can access all of the commands described below. Internally,
|
|
the database handle is sent as the <I>ClientData</I> portion of the new
|
|
command set so that all future database calls access the appropriate handle.
|
|
<P>The arguments are:
|
|
<UL>
|
|
<LI>
|
|
<B>-- </B>- Terminate the list of options and use remaining arguments as
|
|
the file or subdb names (thus allowing the use of filenames beginning with
|
|
a dash '-')</LI>
|
|
|
|
<LI>
|
|
<B>-create</B> selects the O_CREAT flag to create underlying files</LI>
|
|
|
|
<LI>
|
|
<B>-rdonly</B> selects the O_RDONLY flag for opening in read-only mode</LI>
|
|
|
|
<LI>
|
|
<B>-truncate</B> selects the O_TRUNC flag to truncate the database</LI>
|
|
|
|
<LI>
|
|
<B>-mode<I> mode</I></B> specifies the mode for created files</LI>
|
|
|
|
<LI>
|
|
<B><I>filename</I></B> indicates the name of the database</LI>
|
|
</UL>
|
|
|
|
<P><BR>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> close</B>
|
|
<P>This command closes the database and renders the handle invalid.
|
|
This command directly translates to the dbm_close function call.
|
|
It returns either a 0 (for success), or it throws a Tcl error with
|
|
a system message.
|
|
<P>Additionally, since the handle is no longer valid, we will call <I>Tcl_DeleteCommand()
|
|
</I>so
|
|
that further uses of the handle will be dealt with properly by Tcl itself.
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> clearerr</B>
|
|
<P>This command clears errors the database. This command
|
|
directly translates to the dbm_clearerr function call. It returns
|
|
either a 0 (for success), or it throws a Tcl error with a system
|
|
message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> delete <I>key</I></B>
|
|
<P>This command deletes the <B><I>key</I></B> from thedatabase.
|
|
This command directly translates to the dbm_delete function call.
|
|
It returns either a 0 (for success), or it throws a Tcl error with
|
|
a system message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> dirfno</B>
|
|
<P>This command directly translates to the dbm_dirfno function call.
|
|
It returns either resultts, or it throws a Tcl error with a system
|
|
message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> error</B>
|
|
<P>This command returns the last error. This command directly
|
|
translates to the dbm_error function call. It returns an error string..
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> fetch <I>key</I></B>
|
|
<P>This command gets the given <B><I>key</I></B> from the database.
|
|
This command directly translates to the dbm_fetch function call.
|
|
It returns either the data, or it throws a Tcl error with a system
|
|
message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> firstkey</B>
|
|
<P>This command returns the first key in the database. This
|
|
command directly translates to the dbm_firstkey function call. It
|
|
returns either the key, or it throws a Tcl error with a system message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> nextkey</B>
|
|
<P>This command returns the next key in the database. This
|
|
command directly translates to the dbm_nextkey function call. It
|
|
returns either the key, or it throws a Tcl error with a system message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> pagfno</B>
|
|
<P>This command directly translates to the dbm_pagfno function call.
|
|
It returns either resultts, or it throws a Tcl error with a system
|
|
message.
|
|
<BR>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> rdonly</B>
|
|
<P>This command changes the database to readonly. This command
|
|
directly translates to the dbm_rdonly function call. It returns either
|
|
a 0 (for success), or it throws a Tcl error with a system message.
|
|
<P>
|
|
<HR WIDTH="100%">
|
|
<BR><B>> <ndbm> store <I>key data </I>insert|replace</B>
|
|
<P>This command puts the given <B><I>key</I></B> and <B><I>data</I></B>
|
|
pair into the database. This command directly translates to
|
|
the dbm_store function call. It will either <B>insert</B> or <B>replace</B>
|
|
the data based on the action given in the third argument. It returns
|
|
either a 0 (for success), or it throws a Tcl error with a system
|
|
message.
|
|
<BR>
|
|
<HR WIDTH="100%">
|
|
</BODY>
|
|
</HTML>
|