bsddb.dbtables
index
/usr/local/lib/python2.4/bsddb/dbtables.py
Module Docs

#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Smith
#
# License:      This is free software.  You may use this software for any
#               purpose including modification/redistribution, so long as
#               this header remains intact and that you do not claim any
#               rights of ownership or authorship of this software.  This
#               software has been tested, but no warranty is expressed or
#               implied.
#
#   --  Gregory P. Smith <greg@electricrain.com>

 
Modules
       
copy
cPickle
random
re
sys
xdrlib

 
Classes
       
Cond
ExactCond
LikeCond
PostfixCond
PrefixCond
bsdTableDB
exceptions.Exception
bsddb._db.DBError
bsddb._db.DBAccessError
bsddb._db.DBAgainError
bsddb._db.DBBusyError
bsddb._db.DBCursorClosedError
bsddb._db.DBFileExistsError
bsddb._db.DBInvalidArgError
bsddb._db.DBKeyEmptyError
bsddb._db.DBKeyExistError
bsddb._db.DBLockDeadlockError
bsddb._db.DBLockNotGrantedError
bsddb._db.DBNoMemoryError
bsddb._db.DBNoServerError
bsddb._db.DBNoServerHomeError
bsddb._db.DBNoServerIDError
bsddb._db.DBNoSpaceError
bsddb._db.DBNoSuchFileError
bsddb._db.DBOldVersionError
bsddb._db.DBPageNotFoundError
bsddb._db.DBPermissionsError
bsddb._db.DBRunRecoveryError
bsddb._db.DBSecondaryBadError
bsddb._db.DBVerifyBadError
exceptions.StandardError(exceptions.Exception)
TableDBError
TableAlreadyExists

 
class Cond
    This condition matches everything
 
  Methods defined here:
__call__(self, s)

 
class DBAccessError(DBError)
    
Method resolution order:
DBAccessError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBAgainError(DBError)
    
Method resolution order:
DBAgainError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBBusyError(DBError)
    
Method resolution order:
DBBusyError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBCursorClosedError(DBError)
    
Method resolution order:
DBCursorClosedError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBError(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBFileExistsError(DBError)
    
Method resolution order:
DBFileExistsError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBInvalidArgError(DBError)
    
Method resolution order:
DBInvalidArgError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBKeyEmptyError(DBError)
    
Method resolution order:
DBKeyEmptyError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBKeyExistError(DBError)
    
Method resolution order:
DBKeyExistError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBLockDeadlockError(DBError)
    
Method resolution order:
DBLockDeadlockError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBLockNotGrantedError(DBError)
    
Method resolution order:
DBLockNotGrantedError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoMemoryError(DBError)
    
Method resolution order:
DBNoMemoryError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoServerError(DBError)
    
Method resolution order:
DBNoServerError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoServerHomeError(DBError)
    
Method resolution order:
DBNoServerHomeError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoServerIDError(DBError)
    
Method resolution order:
DBNoServerIDError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoSpaceError(DBError)
    
Method resolution order:
DBNoSpaceError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBNoSuchFileError(DBError)
    
Method resolution order:
DBNoSuchFileError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBOldVersionError(DBError)
    
Method resolution order:
DBOldVersionError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBPageNotFoundError(DBError)
    
Method resolution order:
DBPageNotFoundError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBPermissionsError(DBError)
    
Method resolution order:
DBPermissionsError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBRunRecoveryError(DBError)
    
Method resolution order:
DBRunRecoveryError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBSecondaryBadError(DBError)
    
Method resolution order:
DBSecondaryBadError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class DBVerifyBadError(DBError)
    
Method resolution order:
DBVerifyBadError
DBError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class ExactCond(Cond)
    Acts as an exact match condition function
 
  Methods defined here:
__call__(self, s)
__init__(self, strtomatch)

 
class LikeCond(Cond)
    Acts as a function that will match using an SQL 'LIKE' style
string.  Case insensitive and % signs are wild cards.
This isn't perfect but it should work for the simple common cases.
 
  Methods defined here:
__call__(self, s)
__init__(self, likestr, re_flags=2)

 
class PostfixCond(Cond)
    Acts as a condition function for matching a string postfix
 
  Methods defined here:
__call__(self, s)
__init__(self, postfix)

 
class PrefixCond(Cond)
    Acts as a condition function for matching a string prefix
 
  Methods defined here:
__call__(self, s)
__init__(self, prefix)

 
class TableAlreadyExists(TableDBError)
    
Method resolution order:
TableAlreadyExists
TableDBError
exceptions.StandardError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class TableDBError(exceptions.StandardError)
    
Method resolution order:
TableDBError
exceptions.StandardError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class bsdTableDB
     Methods defined here:
CreateOrExtendTable(self, table, columns)
CreateOrExtendTable(table, columns)
 
- Create a new table in the database.
If a table of this name already exists, extend it to have any
additional columns present in the given list as well as
all of its current columns.
CreateTable(self, table, columns)
CreateTable(table, columns) - Create a new table in the database
raises TableDBError if it already exists or for other DB errors.
Delete(self, table, conditions={})
Delete(table, conditions) - Delete items matching the given
conditions from the table.
* conditions is a dictionary keyed on column names
containing condition functions expecting the data string as an
argument and returning a boolean.
Drop(self, table)
Remove an entire table from the database
Insert(self, table, rowdict)
Insert(table, datadict) - Insert a new row into the table
using the keys+values from rowdict as the column values.
ListTableColumns(self, table)
Return a list of columns in the given table.
[] if the table doesn't exist.
ListTables(self)
Return a list of tables in this database.
Modify(self, table, conditions={}, mappings={})
Modify(table, conditions) - Modify in rows matching 'conditions'
using mapping functions in 'mappings'
* conditions is a dictionary keyed on column names
containing condition functions expecting the data string as an
argument and returning a boolean.
* mappings is a dictionary keyed on column names containint condition
functions expecting the data string as an argument and returning the
new string for that column.
Select(self, table, columns, conditions={})
Select(table, conditions) - retrieve specific row data
Returns a list of row column->value mapping dictionaries.
* columns is a list of which column data to return.  If
  columns is None, all columns will be returned.
* conditions is a dictionary keyed on column names
  containing callable conditions expecting the data string as an
  argument and returning a boolean.
__del__(self)
__init__(self, filename, dbhome, create=0, truncate=0, mode=384, recover=0, dbflags=0)
bsdTableDB.open(filename, dbhome, create=0, truncate=0, mode=0600)
Open database name in the dbhome BerkeleyDB directory.
Use keyword arguments when calling this constructor.
checkpoint(self, mins=0)
close(self)
sync(self)

 
Functions
       
DB(...)
DBEnv(...)
contains_metastrings(s)
Verify that the given string does not contain any
metadata strings that might interfere with dbtables database operation.
version(...)
Returns a tuple of major, minor, and patch release numbers of the
underlying DB library.

 
Data
        DB_AFTER = 1
DB_AGGRESSIVE = 1
DB_APPEND = 2
DB_ARCH_ABS = 1
DB_ARCH_DATA = 2
DB_ARCH_LOG = 4
DB_AUTO_COMMIT = 8388608
DB_BEFORE = 3
DB_BTREE = 1
DB_CACHED_COUNTS = 4
DB_CDB_ALLDB = 2048
DB_CHECKPOINT = 0
DB_CLIENT = 1
DB_COMMIT = 5
DB_CONSUME = 6
DB_CONSUME_WAIT = 7
DB_CREATE = 1
DB_CURRENT = 8
DB_DIRTY_READ = 16777216
DB_DONOTINDEX = -30999
DB_DUP = 2
DB_DUPSORT = 4
DB_ENCRYPT_AES = 1
DB_EXCL = 2048
DB_EXTENT = 4096
DB_FAST_STAT = 9
DB_FCNTL_LOCKING = 4096
DB_FIRST = 10
DB_FLUSH = 33554432
DB_FORCE = 4
DB_GET_BOTH = 11
DB_GET_RECNO = 14
DB_HASH = 2
DB_INCOMPLETE = 0
DB_INIT_CDB = 2048
DB_INIT_LOCK = 4096
DB_INIT_LOG = 8192
DB_INIT_MPOOL = 16384
DB_INIT_TXN = 32768
DB_JOINENV = 65536
DB_JOIN_ITEM = 15
DB_JOIN_NOSORT = 1
DB_KEYEMPTY = -30998
DB_KEYEXIST = -30997
DB_KEYFIRST = 16
DB_KEYLAST = 17
DB_LAST = 18
DB_LOCKDOWN = 131072
DB_LOCK_CONFLICT = 0
DB_LOCK_DEADLOCK = -30996
DB_LOCK_DEFAULT = 1
DB_LOCK_DIRTY = 7
DB_LOCK_DUMP = 0
DB_LOCK_GET = 1
DB_LOCK_INHERIT = 3
DB_LOCK_IREAD = 5
DB_LOCK_IWR = 6
DB_LOCK_IWRITE = 4
DB_LOCK_MAXLOCKS = 3
DB_LOCK_MINLOCKS = 4
DB_LOCK_MINWRITE = 5
DB_LOCK_NG = 0
DB_LOCK_NORUN = 0
DB_LOCK_NOTGRANTED = -30995
DB_LOCK_NOWAIT = 2
DB_LOCK_OLDEST = 6
DB_LOCK_PUT = 4
DB_LOCK_PUT_ALL = 5
DB_LOCK_PUT_OBJ = 6
DB_LOCK_RANDOM = 7
DB_LOCK_READ = 1
DB_LOCK_RECORD = 4
DB_LOCK_SWITCH = 32
DB_LOCK_UPGRADE = 64
DB_LOCK_UPGRADE_WRITE = 10
DB_LOCK_WAIT = 3
DB_LOCK_WRITE = 2
DB_LOCK_WWRITE = 8
DB_LOCK_YOUNGEST = 8
DB_LSTAT_ABORTED = 1
DB_LSTAT_ERR = 2
DB_LSTAT_FREE = 4
DB_LSTAT_HELD = 5
DB_LSTAT_PENDING = 7
DB_LSTAT_WAITING = 8
DB_MAX_PAGES = -1
DB_MAX_RECORDS = -1
DB_MULTIPLE = 67108864
DB_MULTIPLE_KEY = 134217728
DB_NEXT = 19
DB_NEXT_DUP = 20
DB_NEXT_NODUP = 21
DB_NODUPDATA = 22
DB_NOLOCKING = 16384
DB_NOMMAP = 8
DB_NOORDERCHK = 2
DB_NOOVERWRITE = 23
DB_NOPANIC = 32768
DB_NOSERVER = -30994
DB_NOSERVER_HOME = -30993
DB_NOSERVER_ID = -30992
DB_NOSYNC = 24
DB_NOTFOUND = -30991
DB_ODDFILESIZE = 8192
DB_OLD_VERSION = -30990
DB_OPFLAGS_MASK = 255
DB_ORDERCHKONLY = 4
DB_PAGE_NOTFOUND = -30989
DB_PANIC_ENVIRONMENT = 131072
DB_POSITION = 25
DB_PREV = 27
DB_PREV_NODUP = 28
DB_PRIVATE = 262144
DB_PR_PAGE = 8
DB_PR_RECOVERYTEST = 16
DB_QUEUE = 4
DB_RDONLY = 16
DB_RDWRMASTER = 8192
DB_RECNO = 3
DB_RECNUM = 16
DB_RECORDCOUNT = 29
DB_RECOVER = 32
DB_RECOVER_FATAL = 524288
DB_REGION_INIT = 262144
DB_RENUMBER = 32
DB_REVSPLITOFF = 64
DB_RMW = 1073741824
DB_RPCCLIENT = 1
DB_RUNRECOVERY = -30982
DB_SALVAGE = 64
DB_SECONDARY_BAD = -30981
DB_SET = 30
DB_SET_LOCK_TIMEOUT = 31
DB_SET_RANGE = 32
DB_SET_RECNO = 33
DB_SET_TXN_TIMEOUT = 35
DB_SNAPSHOT = 128
DB_STAT_CLEAR = 1
DB_SYSTEM_MEM = 1048576
DB_THREAD = 64
DB_TRUNCATE = 128
DB_TXN_NOSYNC = 256
DB_TXN_NOWAIT = 2048
DB_TXN_SYNC = 4096
DB_UNKNOWN = 5
DB_UPGRADE = 1
DB_USE_ENVIRON = 512
DB_USE_ENVIRON_ROOT = 1024
DB_VERIFY = 2
DB_VERIFY_BAD = -30980
DB_VERSION_MAJOR = 4
DB_VERSION_MINOR = 1
DB_VERSION_PATCH = 25
DB_VERSION_STRING = 'Sleepycat Software: Berkeley DB 4.1.25: (August 21, 2003)'
DB_WRITECURSOR = 37
DB_XA_CREATE = 1
DB_YIELDCPU = 1048576
EACCES = 13
EAGAIN = 11
EBUSY = 16
EEXIST = 17
EINVAL = 22
ENOENT = 2
ENOMEM = 12
ENOSPC = 28
EPERM = 1
cvsid = '$Id: _bsddb.c,v 1.38 2004/09/04 01:36:59 greg Exp $'