12 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
13 |
|
|
14 |
import dbflib |
import dbflib |
15 |
|
from Thuban.common import * |
16 |
|
|
17 |
# the field types supported by a Table instance. |
# the field types supported by a Table instance. |
18 |
FIELDTYPE_INT = "int" |
#FIELDTYPE_INT = "int" |
19 |
FIELDTYPE_STRING = "string" |
#FIELDTYPE_STRING = "string" |
20 |
FIELDTYPE_DOUBLE = "double" |
#FIELDTYPE_DOUBLE = "double" |
21 |
|
|
22 |
|
|
23 |
# map the dbflib constants for the field types to our constants |
# map the dbflib constants for the field types to our constants |
76 |
type = dbflib_fieldtypes[type] |
type = dbflib_fieldtypes[type] |
77 |
return type, name, width, prec |
return type, name, width, prec |
78 |
|
|
79 |
|
def field_info_by_name(self, fieldName): |
80 |
|
count = self.field_count() |
81 |
|
|
82 |
|
for i in range(count): |
83 |
|
info = self.field_info(i) |
84 |
|
if info[1] == fieldName: |
85 |
|
return info |
86 |
|
|
87 |
|
return None |
88 |
|
|
89 |
def read_record(self, record): |
def read_record(self, record): |
90 |
"""Return the record no. record as a dict mapping field names to values |
"""Return the record no. record as a dict mapping field names to values |
91 |
""" |
""" |
111 |
self._writable = 1 |
self._writable = 1 |
112 |
self.dbf.write_record(record, values) |
self.dbf.write_record(record, values) |
113 |
self.dbf.commit() |
self.dbf.commit() |
114 |
|
|