~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to db/docs/ref/tcl/using.html

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.-->
 
4
<html>
 
5
<head>
 
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++">
 
9
</head>
 
10
<body bgcolor=white>
 
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>
 
15
</td></tr></table>
 
16
<p>
 
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
 
36
db0
 
37
#Get some data from that database
 
38
% db0 get my_key
 
39
{{my_key my_data0}{my_key my_data1}}
 
40
#Open a cursor in this database, get a new cursor handle
 
41
% db0 cursor
 
42
db0.c0
 
43
#Get the first data from the cursor
 
44
% db0.c0 get -first
 
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>
 
51
</td></tr></table>
 
52
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
 
53
</body>
 
54
</html>