Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
666255f5
Commit
666255f5
authored
Apr 15, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the dbhash module, and link to it from appropriate places.
parent
f4cbada3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
3 deletions
+94
-3
Doc/lib/lib.tex
Doc/lib/lib.tex
+1
-0
Doc/lib/libanydbm.tex
Doc/lib/libanydbm.tex
+3
-2
Doc/lib/libdbhash.tex
Doc/lib/libdbhash.tex
+89
-0
Doc/lib/libshelve.tex
Doc/lib/libshelve.tex
+1
-1
No files found.
Doc/lib/lib.tex
View file @
666255f5
...
...
@@ -143,6 +143,7 @@ add new extensions to Python and how to embed it in other applications.
\input
{
libthreading
}
\input
{
libqueue
}
\input
{
libanydbm
}
\input
{
libdbhash
}
\input
{
libwhichdb
}
\input
{
libzlib
}
\input
{
libgzip
}
...
...
Doc/lib/libanydbm.tex
View file @
666255f5
...
...
@@ -6,7 +6,8 @@
\module
{
anydbm
}
is a generic interface to variants of the DBM
database ---
\module
{
dbhash
}
\refbimodindex
{
dbhash
}
,
database ---
\refmodule
{
dbhash
}
\refstmodindex
{
dbhash
}
(requires
\module
{
bsddb
}
\refbimodindex
{
bsddb
}
),
\refmodule
{
gdbm
}
\refbimodindex
{
gdbm
}
, or
\refmodule
{
dbm
}
\refbimodindex
{
dbm
}
. If none of these modules is
installed, the slow-but-simple implementation in module
...
...
@@ -48,7 +49,7 @@ strings.
\begin{seealso}
\seemodule
{
anydbm
}{
Generic interface to
\code
{
dbm
}
-style databases.
}
% Should include entry for dbhash, but that isn't documented.
\seemodule
{
dbhash
}{
BSD
\code
{
db
}
database interface.
}
\seemodule
{
dbm
}{
Standard
\UNIX
{}
database interface.
}
\seemodule
{
dumbdbm
}{
Portable implementation of the
\code
{
dbm
}
interface.
}
\seemodule
{
gdbm
}{
GNU database interface, based on the
\code
{
dbm
}
interface.
}
...
...
Doc/lib/libdbhash.tex
0 → 100644
View file @
666255f5
\section
{
\module
{
dbhash
}
---
DBM-style interface to the BSD database library
}
\declaremodule
{
standard
}{
dbhash
}
\platform
{
Unix, Windows
}
\modulesynopsis
{
DBM-style interface to the BSD database library.
}
The
\module
{
dbhash
}
module provides a function to open databases using
the BSD
\code
{
db
}
library. This module mirrors the interface of the
other Python database modules that provide access to DBM-style
databases. The
\module
{
bsddb
}
\refbimodindex
{
bsddb
}
module is required
to use
\module
{
dbhash
}
.
This module provides an exception and a function:
\begin{excdesc}
{
error
}
Exception raised on database errors other than
\exception
{
KeyError
}
. It is a synonym for
\exception
{
bsddb.error
}
.
\end{excdesc}
\begin{funcdesc}
{
open
}{
path, flag
\optional
{
, mode
}}
Open a
\code
{
db
}
database and return the database object. The
\var
{
path
}
argument is the name of the database file.
The
\var
{
flag
}
argument can be
\code
{
'r'
}
(to open an existing database for reading only --- default),
\code
{
'w'
}
(to open an existing database for reading and writing),
\code
{
'c'
}
(which creates the database if it doesn't exist), or
\code
{
'n'
}
(which always creates a new empty database).
For platforms on which the BSD
\code
{
db
}
library supports locking,
an
\character
{
l
}
can be appended to indicate that locking should be
used.
The optional
\var
{
mode
}
parameter is used to indicate the
\UNIX
{}
permission bits that should be set if a new database must be
created; this will be masked by the current umask value for the
process.
\end{funcdesc}
\begin{seealso}
\seemodule
{
anydbm
}{
Generic interface to
\code
{
dbm
}
-style databases.
}
\seemodule
{
whichdb
}{
Utility module used to determine the type of an
existing database.
}
\end{seealso}
\subsection
{
Database Objects
\label
{
dbhash-objects
}}
The database objects returned by
\function
{
open()
}
provide the methods
common to all the DBM-style databases. The following methods are
available in addition to the standard methods.
\begin{methoddesc}
[dbhash]
{
first
}{}
It's possible to loop over every key in the database using this method
and the
\method
{
next()
}
method. The traversal is ordered by
the databases internal hash values, and won't be sorted by the key
values. This method returns the starting key.
\end{methoddesc}
\begin{methoddesc}
[dbhash]
{
last
}{}
Return the last key in a database traversal. This may be used to
begin a reverse-order traversal; see
\method
{
previous()
}
.
\end{methoddesc}
\begin{methoddesc}
[dbhash]
{
next
}{
key
}
Returns the key that follows
\var
{
key
}
in the traversal. The
following code prints every key in the database
\code
{
db
}
, without
having to create a list in memory that contains them all:
\begin{verbatim}
k = db.first()
while k != None:
print k
k = db.next(k)
\end{verbatim}
\end{methoddesc}
\begin{methoddesc}
[dbhash]
{
previous
}{
key
}
Return the key that comes before
\var
{
key
}
in a forward-traversal of
the database. In conjunction with
\method
{
last()
}
, this may be used
to implement a reverse-order traversal.
\end{methoddesc}
\begin{methoddesc}
[dbhash]
{
sync
}{}
This method forces any unwritten data to be written to the disk.
\end{methoddesc}
Doc/lib/libshelve.tex
View file @
666255f5
...
...
@@ -66,7 +66,7 @@ requires knowledge about the database implementation used.
\begin{seealso}
\seemodule
{
anydbm
}{
Generic interface to
\code
{
dbm
}
-style databases.
}
% Should include entry for dbhash, but that isn't documented.
\seemodule
{
dbhash
}{
BSD
\code
{
db
}
database interface.
}
\seemodule
{
dbm
}{
Standard
\UNIX
{}
database interface.
}
\seemodule
{
dumbdbm
}{
Portable implementation of the
\code
{
dbm
}
interface.
}
\seemodule
{
gdbm
}{
GNU database interface, based on the
\code
{
dbm
}
interface.
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment