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,
_move=False)
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,
_move=False)
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
|
|
|
is_decimal(yo,
name)
returns True if name is a variable-length field type |
source code
|
|
|
is_memotype(yo,
name)
returns True if name is a memo type field |
source code
|
|
|
new(yo,
filename,
field_specs=None,
codepage=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_command=None,
python=None)
uses exec to perform queries on the table |
source code
|
|
|
|
|
rename_field(yo,
oldname,
newname)
renames an existing 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
|
|
backup = False
|
|
codepage = <dbf.tables.property object at 0x00EC7DD0>
|
|
field_count = <dbf.tables.property object at 0x00EC7DF0>
|
|
field_names = <dbf.tables.property object at 0x00EC7E10>
|
|
filename = <dbf.tables.property object at 0x00EC7E30>
|
|
last_update = <dbf.tables.property object at 0x00EC7E50>
|
|
memoname = <dbf.tables.property object at 0x00EC7E70>
|
|
record_length = <dbf.tables.property object at 0x00EC7E90>
|
|
record_number = <dbf.tables.property object at 0x00EC7EB0>
|
|
supported_tables = <dbf.tables.property object at 0x00EC7ED0>
|
|
use_deleted = <dbf.tables.property object at 0x00EC7EF0>
|
|
version = <dbf.tables.property object at 0x00EC7F10>
|