Sindbad~EG File Manager
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Using Berkeley DB with Tcl</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
<link rel="up" href="tcl.html" title="Chapter 22. Berkeley DB Extensions: Tcl" />
<link rel="prev" href="tcl.html" title="Chapter 22. Berkeley DB Extensions: Tcl" />
<link rel="next" href="tcl_program.html" title="Tcl API programming notes" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 18.1.40</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Using Berkeley DB with Tcl</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="tcl.html">Prev</a> </td>
<th width="60%" align="center">Chapter 22. Berkeley DB Extensions: Tcl </th>
<td width="20%" align="right"> <a accesskey="n" href="tcl_program.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="tcl_using"></a>Using Berkeley DB with Tcl</h2>
</div>
</div>
</div>
<p>
All commands in the Berkeley DB Tcl interface are in the
following form:
</p>
<pre class="programlisting">command_handle operation options</pre>
<p>
The <span class="emphasis"><em>command handle</em></span> is <span class="bold"><strong>berkdb</strong></span> or one of the additional
commands that may be created. The
<span class="emphasis"><em>operation</em></span> is what you want to do to
that handle, and the <span class="emphasis"><em>options</em></span> apply to the
operation. Commands that get created on behalf of the
application have their own sets of operations. Generally, any
calls in DB that result in new object handles will translate
into a new command handle in Tcl. Then, the user can access
the operations of the handle via the new Tcl command
handle.
</p>
<p>
Newly created commands are named with an abbreviated form of
their objects, followed by a number. Some created commands are
subcommands of other created commands and will be the first
command, followed by a period (.), and then followed by the
new subcommand. For example, suppose that you have a database
already existing called my_data.db. The following example
shows the commands created when you open the database and when
you open a cursor:
</p>
<pre class="programlisting"># First open the database and get a database command handle
% berkdb open my_data.db
db0
#Get some data from that database
% db0 get my_key
{{my_key my_data0}{my_key my_data1}}
#Open a cursor in this database, get a new cursor handle
% db0 cursor
db0.c0
#Get the first data from the cursor
% db0.c0 get -first
{{first_key first_data}}</pre>
<p>
All commands in the library support a special option
<span class="bold"><strong>-?</strong></span> that will list the
correct operations for a command or the correct
options.
</p>
<p>
A list of commands and operations can be found in the <a href="../api_reference/TCL/index.html" class="olink">Tcl API</a>
documentation.
</p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="tcl.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="tcl.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="tcl_program.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 22. Berkeley DB Extensions: Tcl </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Tcl API programming notes</td>
</tr>
</table>
</div>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists