Provides a framework for dbf style tables.
|
_buildHeaderFields(yo)
constructs fieldblock for disk table |
source code
|
|
|
|
|
_initializeFields(yo)
builds the FieldList of names, types, and descriptions from the disk
file |
source code
|
|
|
_fieldLayout(yo,
i)
Returns field information Name Type(Length[,Decimals]) |
source code
|
|
|
_loadtable(yo)
loads the records from disk to memory |
source code
|
|
|
|
|
_update_disk(yo,
headeronly=False)
synchronizes the disk file with current data |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
__init__(yo,
filename=' :memory: ' ,
field_specs=None,
memo_size=128,
ignore_memos=False,
read_only=False,
keep_memos=False,
meta_only=False,
codepage=None)
open/create dbf file filename should include path if needed
field_specs can be either a ;-delimited string or a list of strings
memo_size is always 512 for db3 memos ignore_memos is useful if the
memo file is missing or corrupt read_only will load records into
memory, then close the disk file keep_memos will also load any memo
fields into memory meta_only will ignore all records, keeping only
basic table information codepage will override whatever is set in the
table itself |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
add_fields(yo,
field_specs)
adds field(s) to the table layout; format is Name
Type(Length,Decimals)[; Name Type(Length,Decimals)[...]] backup table
is created with _backup appended to name then modifies current
structure |
source code
|
|
|
append(yo,
kamikaze='
' ,
drop=False,
multiple=1)
adds <multiple> blank records, and fills fields with dict/tuple
values if present |
source code
|
|
|
bof(yo)
moves record pointer to previous usable record; returns True if no
more usable records |
source code
|
|
|
bottom(yo,
get_record=False)
sets record pointer to bottom of table if get_record, seeks to and
returns last (non-deleted) record DbfError if table is empty Bof if
all records deleted and use_deleted is False |
source code
|
|
|
close(yo,
keep_table=False,
keep_memos=False)
closes disk files ensures table data is available if keep_table
ensures memo data is available if keep_memos |
source code
|
|
|
create_backup(yo,
new_name=None,
overwrite=False)
creates a backup table -- ignored if memory table |
source code
|
|
|
current(yo,
index=False)
returns current logical record, or its index |
source code
|
|
|
delete_fields(yo,
doomed)
removes field(s) from the table creates backup files with _backup
appended to the file name, then modifies current structure |
source code
|
|
|
eof(yo)
moves record pointer to next usable record; returns True if no more
usable records |
source code
|
|
|
export(yo,
records=None,
filename=None,
field_specs=None,
format=' csv ' ,
header=True)
writes the table using CSV or tab-delimited format, using the
filename given if specified, otherwise the table name |
source code
|
|
|
get_record(yo,
recno)
returns record at physical_index[recno] |
source code
|
|
|
goto(yo,
criteria)
changes the record pointer to the first matching (non-deleted) record
criteria should be either a tuple of tuple(value, field, func)
triples, or an integer to go to |
source code
|
|
|
index(yo,
sort=None,
reverse=False)
orders the table using the tuple provided; removes index if no sort
provided |
source code
|
|
|
is_memotype(yo,
name)
returns True if name is a memo type field |
source code
|
|
|
new(yo,
filename,
_field_specs=None)
returns a new table of the same type |
source code
|
|
|
next(yo)
set record pointer to next (non-deleted) record, and return it |
source code
|
|
|
pack(yo,
_pack=True)
physically removes all deleted records |
source code
|
|
|
prev(yo)
set record pointer to previous (non-deleted) record, and return it |
source code
|
|
|
query(yo,
sql=None,
python=None)
uses exec to perform python queries on the table |
source code
|
|
|
rename_field(yo,
oldname,
newname)
renames an existing field |
source code
|
|
|
search(yo,
match,
fuzzy=None,
indices=False)
searches using a binary algorythm looking for records that match the
criteria in match, which is a tuple with a data item per ordered
field. |
source code
|
|
|
size(yo,
field)
returns size of field as a tuple of (length, decimals) |
source code
|
|
|
structure(yo,
fields=None)
return list of fields suitable for creating same table layout |
source code
|
|
|
top(yo,
get_record=False)
sets record pointer to top of table; if get_record, seeks to and
returns first (non-deleted) record DbfError if table is empty Eof if
all records are deleted and use_deleted is False |
source code
|
|
|
|
|
zap(yo,
areyousure=False)
removes all records from table -- this cannot be undone! areyousure
must be True, else error is raised |
source code
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
|
_version = ' basic memory table '
|
|
_versionabbv = ' dbf '
|
|
_fieldtypes = { ' D ' : { ' Blank ' : <bound method type.today of <cla...
|
|
_memoext = '
'
|
|
_memotypes = ( ' M ' )
|
|
_yesMemoMask = '
'
|
|
_noMemoMask = '
'
|
|
_fixed_fields = ( ' M ' , ' D ' , ' L ' )
|
|
_variable_fields = ( )
|
|
_character_fields = ( ' M ' )
|
|
_decimal_fields = ( )
|
|
_numeric_fields = ( )
|
|
_dbfTableHeader = ' \x00\x00\x00\x00\x00\x00\x00\x00!\x00\x01\x ...
|
|
_dbfTableHeaderExtra = '
'
|
|
_supported_tables = [ ]
|
|
_read_only = False
|
|
_meta_only = False
|
|
_use_deleted = True
|
|
_backed_up = False
|
|
codepage = <dbf.tables.property object at 0x00EFEA70>
|
|
field_count = <dbf.tables.property object at 0x00EFEA90>
|
|
field_names = <dbf.tables.property object at 0x00EFEAB0>
|
|
filename = <dbf.tables.property object at 0x00EFEAD0>
|
|
last_update = <dbf.tables.property object at 0x00EFEAF0>
|
|
memoname = <dbf.tables.property object at 0x00EFEB10>
|
|
record_length = <dbf.tables.property object at 0x00EFEB30>
|
|
record_number = <dbf.tables.property object at 0x00EFEB50>
|
|
supported_tables = <dbf.tables.property object at 0x00EFEB70>
|
|
use_deleted = <dbf.tables.property object at 0x00EFEB90>
|
|
version = <dbf.tables.property object at 0x00EFEBB0>
|