1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
<!--Copyright 1999-2002 by Sleepycat Software, Inc.-->
<!--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>
|