| 1 |
<!--Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved.--> |
| 2 |
<HTML> |
| 3 |
<HEAD> |
| 4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> |
| 5 |
<META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; FreeBSD 2.2.8-19990120-SNAP i386) [Netscape]"> |
| 6 |
</HEAD> |
| 7 |
<BODY> |
| 8 |
|
| 9 |
<H2> |
| 10 |
<A NAME="Compatibility Commands"></A>Compatibility Commands</H2> |
| 11 |
The compatibility commands for old Dbm and Ndbm are described in the <A HREF="../../docs/api_c/dbm.html">dbm</A> |
| 12 |
manpage. |
| 13 |
<P><B>> berkdb dbminit <I>filename</I></B> |
| 14 |
<P>This command will invoke the dbminit function. <B><I>Filename</I></B> |
| 15 |
is used as the name of the database. |
| 16 |
<P> |
| 17 |
<HR WIDTH="100%"><B>> berkdb dbmclose</B> |
| 18 |
<P>This command will invoke the dbmclose function. |
| 19 |
<P> |
| 20 |
<HR WIDTH="100%"><B>> berkdb fetch <I>key</I></B> |
| 21 |
<P>This command will invoke the fetch function. It will return |
| 22 |
the data associated with the given <B><I>key </I></B>or a Tcl error. |
| 23 |
<P> |
| 24 |
<HR WIDTH="100%"><B>> berkdb store <I>key data</I></B> |
| 25 |
<P>This command will invoke the store function. It will store |
| 26 |
the <B><I>key/data</I></B> pair. It will return a 0 on success or |
| 27 |
throw a Tcl error. |
| 28 |
<P> |
| 29 |
<HR WIDTH="100%"><B>> berkdb delete <I>key</I></B> |
| 30 |
<P>This command will invoke the deletet function. It will delete |
| 31 |
the <B><I>key</I></B> from the database. It will return a 0 on success |
| 32 |
or throw a Tcl error. |
| 33 |
<P> |
| 34 |
<HR WIDTH="100%"><B>> berkdb firstkey</B> |
| 35 |
<P>This command will invoke the firstkey function. It will |
| 36 |
return the first key in the database or a Tcl error. |
| 37 |
<P> |
| 38 |
<HR WIDTH="100%"><B>> berkdb nextkey <I>key</I></B> |
| 39 |
<P>This command will invoke the nextkey function. It will return |
| 40 |
the next key after the given <B><I>key</I></B> or a Tcl error. |
| 41 |
<P> |
| 42 |
<HR WIDTH="100%"><B>> berkdb hcreate <I>nelem</I></B> |
| 43 |
<P>This command will invoke the hcreate function with <B><I>nelem</I></B> |
| 44 |
elements. It will return a 0 on success or a Tcl error. |
| 45 |
<P> |
| 46 |
<HR WIDTH="100%"><B>> berkdb hsearch <I>key data action</I></B> |
| 47 |
<P>This command will invoke the hsearch function with <B><I>key</I></B> |
| 48 |
and <B><I>data</I></B>. The <B><I>action</I></B> must be either <B>find</B> |
| 49 |
or <B>enter</B>. If it is <B>find</B>, it will return the resultant |
| 50 |
data. If it is <B>enter</B>, it will return a 0 on success or a Tcl |
| 51 |
error. |
| 52 |
<P> |
| 53 |
<HR WIDTH="100%"><B>> berkdb hdestroy</B> |
| 54 |
<P>This command will invoke the hdestroy function. It will return |
| 55 |
a 0. |
| 56 |
<HR WIDTH="100%"><B>> berkdb ndbm_open [-create] [-rdonly] [-truncate] |
| 57 |
[-mode |
| 58 |
<I>mode</I>] [--] <I>filename</I></B> |
| 59 |
<P>This command will invoke the dbm_open function. After |
| 60 |
it successfully gets a handle to a database, we bind it to a new Tcl command |
| 61 |
of the form <B><I>ndbmX, </I></B>where X is an integer starting at 0 (e.g. |
| 62 |
<B>ndbm0, |
| 63 |
ndbm1, </B>etc). We use the <I>Tcl_CreateObjCommand() </I> to |
| 64 |
create the top level database function. It is through this handle |
| 65 |
that the user can access all of the commands described below. Internally, |
| 66 |
the database handle is sent as the <I>ClientData</I> portion of the new |
| 67 |
command set so that all future database calls access the appropriate handle. |
| 68 |
<P>The arguments are: |
| 69 |
<UL> |
| 70 |
<LI> |
| 71 |
<B>-- </B>- Terminate the list of options and use remaining arguments as |
| 72 |
the file or subdb names (thus allowing the use of filenames beginning with |
| 73 |
a dash '-')</LI> |
| 74 |
|
| 75 |
<LI> |
| 76 |
<B>-create</B> selects the O_CREAT flag to create underlying files</LI> |
| 77 |
|
| 78 |
<LI> |
| 79 |
<B>-rdonly</B> selects the O_RDONLY flag for opening in read-only mode</LI> |
| 80 |
|
| 81 |
<LI> |
| 82 |
<B>-truncate</B> selects the O_TRUNC flag to truncate the database</LI> |
| 83 |
|
| 84 |
<LI> |
| 85 |
<B>-mode<I> mode</I></B> specifies the mode for created files</LI> |
| 86 |
|
| 87 |
<LI> |
| 88 |
<B><I>filename</I></B> indicates the name of the database</LI> |
| 89 |
</UL> |
| 90 |
|
| 91 |
<P><BR> |
| 92 |
<HR WIDTH="100%"> |
| 93 |
<BR><B>> <ndbm> close</B> |
| 94 |
<P>This command closes the database and renders the handle invalid. |
| 95 |
This command directly translates to the dbm_close function call. |
| 96 |
It returns either a 0 (for success), or it throws a Tcl error with |
| 97 |
a system message. |
| 98 |
<P>Additionally, since the handle is no longer valid, we will call <I>Tcl_DeleteCommand() |
| 99 |
</I>so |
| 100 |
that further uses of the handle will be dealt with properly by Tcl itself. |
| 101 |
<HR WIDTH="100%"> |
| 102 |
<BR><B>> <ndbm> clearerr</B> |
| 103 |
<P>This command clears errors the database. This command |
| 104 |
directly translates to the dbm_clearerr function call. It returns |
| 105 |
either a 0 (for success), or it throws a Tcl error with a system |
| 106 |
message. |
| 107 |
<P> |
| 108 |
<HR WIDTH="100%"> |
| 109 |
<BR><B>> <ndbm> delete <I>key</I></B> |
| 110 |
<P>This command deletes the <B><I>key</I></B> from thedatabase. |
| 111 |
This command directly translates to the dbm_delete function call. |
| 112 |
It returns either a 0 (for success), or it throws a Tcl error with |
| 113 |
a system message. |
| 114 |
<P> |
| 115 |
<HR WIDTH="100%"> |
| 116 |
<BR><B>> <ndbm> dirfno</B> |
| 117 |
<P>This command directly translates to the dbm_dirfno function call. |
| 118 |
It returns either resultts, or it throws a Tcl error with a system |
| 119 |
message. |
| 120 |
<P> |
| 121 |
<HR WIDTH="100%"> |
| 122 |
<BR><B>> <ndbm> error</B> |
| 123 |
<P>This command returns the last error. This command directly |
| 124 |
translates to the dbm_error function call. It returns an error string.. |
| 125 |
<P> |
| 126 |
<HR WIDTH="100%"> |
| 127 |
<BR><B>> <ndbm> fetch <I>key</I></B> |
| 128 |
<P>This command gets the given <B><I>key</I></B> from the database. |
| 129 |
This command directly translates to the dbm_fetch function call. |
| 130 |
It returns either the data, or it throws a Tcl error with a system |
| 131 |
message. |
| 132 |
<P> |
| 133 |
<HR WIDTH="100%"> |
| 134 |
<BR><B>> <ndbm> firstkey</B> |
| 135 |
<P>This command returns the first key in the database. This |
| 136 |
command directly translates to the dbm_firstkey function call. It |
| 137 |
returns either the key, or it throws a Tcl error with a system message. |
| 138 |
<P> |
| 139 |
<HR WIDTH="100%"> |
| 140 |
<BR><B>> <ndbm> nextkey</B> |
| 141 |
<P>This command returns the next key in the database. This |
| 142 |
command directly translates to the dbm_nextkey function call. It |
| 143 |
returns either the key, or it throws a Tcl error with a system message. |
| 144 |
<P> |
| 145 |
<HR WIDTH="100%"> |
| 146 |
<BR><B>> <ndbm> pagfno</B> |
| 147 |
<P>This command directly translates to the dbm_pagfno function call. |
| 148 |
It returns either resultts, or it throws a Tcl error with a system |
| 149 |
message. |
| 150 |
<BR> |
| 151 |
<HR WIDTH="100%"> |
| 152 |
<BR><B>> <ndbm> rdonly</B> |
| 153 |
<P>This command changes the database to readonly. This command |
| 154 |
directly translates to the dbm_rdonly function call. It returns either |
| 155 |
a 0 (for success), or it throws a Tcl error with a system message. |
| 156 |
<P> |
| 157 |
<HR WIDTH="100%"> |
| 158 |
<BR><B>> <ndbm> store <I>key data </I>insert|replace</B> |
| 159 |
<P>This command puts the given <B><I>key</I></B> and <B><I>data</I></B> |
| 160 |
pair into the database. This command directly translates to |
| 161 |
the dbm_store function call. It will either <B>insert</B> or <B>replace</B> |
| 162 |
the data based on the action given in the third argument. It returns |
| 163 |
either a 0 (for success), or it throws a Tcl error with a system |
| 164 |
message. |
| 165 |
<BR> |
| 166 |
<HR WIDTH="100%"> |
| 167 |
</BODY> |
| 168 |
</HTML> |