File: keydata.html

package info (click to toggle)
evolution-data-server 1.0.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 39,504 kB
  • ctags: 26,423
  • sloc: ansic: 175,347; tcl: 30,499; sh: 20,699; perl: 11,320; xml: 9,039; java: 7,653; cpp: 6,029; makefile: 4,866; awk: 1,338; yacc: 1,103; sed: 772; cs: 505; lex: 134; asm: 14
file content (49 lines) | stat: -rw-r--r-- 3,102 bytes parent folder | download | duplicates (3)
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
<!--$Id: keydata.html,v 1.1.1.1 2003/11/20 22:14:21 toshok Exp $-->
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Key/data pairs</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Simple Tutorial</dl></h3></td>
<td align=right><a href="../../ref/simple_tut/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/simple_tut/handles.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p>
<h1 align=center>Key/data pairs</h1>
<p>Berkeley DB uses key/data pairs to identify elements in the database.
That is, in the general case, whenever you call a Berkeley DB interface,
you present a key to identify the key/data pair on which you intend
to operate.
<p>For example, you might store some key/data pairs as follows:
<p><table border=1>
<tr><th>Key:</th><th>Data:</th></tr>
<tr><td>fruit</td><td>apple</td></tr>
<tr><td>sport</td><td>cricket</td></tr>
<tr><td>drink</td><td>water</td></tr>
</table>
<p>In each case, the first element of the pair is the key, and the second is
the data.  To store the first of these key/data pairs into the database,
you would call the Berkeley DB interface to store items, with <b>fruit</b> as
the key, and <b>apple</b> as the data.  At some future time, you could
then retrieve the data item associated with <b>fruit</b>, and the Berkeley DB
retrieval interface would return <b>apple</b> to you.  While there are
many variations and some subtleties, all accesses to data in Berkeley DB come
down to key/data pairs.
<p>Both key and data items are stored in simple structures (called
<a href="../../api_c/dbt_class.html">DBT</a>s) that contain a reference to memory and a length, counted
in bytes.  (The name <a href="../../api_c/dbt_class.html">DBT</a> is an acronym for <i>database
thang</i>, chosen because nobody could think of a sensible name that wasn't
already in use somewhere else.)  Key and data items can be arbitrary
binary data of practically any length, including 0 bytes.  There is a
single data item for each key item, by default, but databases can be
configured to support multiple data items for each key item.
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/simple_tut/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/simple_tut/handles.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
</body>
</html>