1
<!--$Id: using.so,v 11.8 2001/03/13 20:39:50 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
6
<title>Berkeley DB Reference Guide: Using Berkeley DB with Tcl</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
13
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Tcl API</dl></h3></td>
14
<td align=right><a href="../../ref/tcl/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/tcl/program.html"><img src="../../images/next.gif" alt="Next"></a>
17
<h1 align=center>Using Berkeley DB with Tcl</h1>
18
<p>All commands in the Berkeley DB Tcl interface are in the following form:
19
<p><blockquote><pre>command_handle operation options</pre></blockquote>
20
<p>The <i>command handle</i> is <b>berkdb</b> or one of the additional
21
commands that may be created. The <i>operation</i> is what you want
22
to do to that handle, and the <i>options</i> apply to the operation.
23
Commands that get created on behalf of the application have their own sets
24
of operations. Generally, any calls in DB that result in new object
25
handles will translate into a new command handle in Tcl. Then, the user
26
can access the operations of the handle via the new Tcl command handle.
27
<p>Newly created commands are named with an abbreviated form of their
28
objects, followed by a number. Some created commands are subcommands of
29
other created commands and will be the first command, followed by a
30
period (.), and then followed by the new subcommand. For example,
31
suppose that you have a database already existing called my_data.db.
32
The following example shows the commands created when you open the
33
database and when you open a cursor:
34
<p><blockquote><pre># First open the database and get a database command handle
35
% berkdb open my_data.db
37
#Get some data from that database
39
{{my_key my_data0}{my_key my_data1}}
40
#Open a cursor in this database, get a new cursor handle
43
#Get the first data from the cursor
45
{{first_key first_data}}</pre></blockquote>
46
<p>All commands in the library support a special option <b>-?</b> that will
47
list the correct operations for a command or the correct options.
48
<p>A list of commands and operations can be found in the
49
<a href="../../api_tcl/tcl_index.html">Tcl Interface</a> documentation.
50
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/tcl/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/tcl/program.html"><img src="../../images/next.gif" alt="Next"></a>
52
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>