bsddb.dbtables
index
/usr/local/lib/python2.5/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(exceptions.BaseException)
DBIncompleteError
exceptions.StandardError(exceptions.Exception)
TableDBError
TableAlreadyExists

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

 
class DBIncompleteError(exceptions.Exception)
    
Method resolution order:
DBIncompleteError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
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
exceptions.BaseException
__builtin__.object

Data descriptors inherited from TableDBError:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.StandardError:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.StandardError:
__new__ = <built-in method __new__ of type object at 0x8125520>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

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

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.StandardError:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.StandardError:
__new__ = <built-in method __new__ of type object at 0x8125520>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
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 - 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={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'
 
* table - the table name
* conditions - a dictionary keyed on column names containing
  a condition callable expecting the data string as an
  argument and returning a boolean.
* mappings - a dictionary keyed on column names containing a
  condition callable expecting the data string as an argument and
  returning the new string for that column.
Select(self, table, columns, conditions={})
Select(table, columns, conditions) - retrieve specific row data
Returns a list of row column->value mapping dictionaries.
 
* columns - a list of which column data to return.  If
  columns is None, all columns will be returned.
* conditions - 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(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 53254 2007-01-05 02:09:06Z gregory.p.smith $'