12 |
|
|
13 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
14 |
|
|
15 |
|
import os |
16 |
import inspect |
import inspect |
17 |
import warnings |
import warnings |
18 |
|
|
147 |
self.column_map[name] = col |
self.column_map[name] = col |
148 |
self.column_map[index] = col |
self.column_map[index] = col |
149 |
|
|
150 |
|
def Title(self): |
151 |
|
"""Return the title of the table. |
152 |
|
|
153 |
|
The title is simply the basename of the filename |
154 |
|
""" |
155 |
|
return os.path.basename(self.filename) |
156 |
|
|
157 |
def NumRows(self): |
def NumRows(self): |
158 |
"""Return the number of rows in the table""" |
"""Return the number of rows in the table""" |
159 |
return self.dbf.record_count() |
return self.dbf.record_count() |
226 |
values.sort() |
values.sort() |
227 |
return values |
return values |
228 |
|
|
229 |
|
def Dependencies(self): |
230 |
|
"""Return an empty sequence. The DBFTable doesn't depend on anything""" |
231 |
|
return () |
232 |
|
|
233 |
# DBF specific interface parts. |
# DBF specific interface parts. |
234 |
|
|
257 |
self.dbf.write_record(record, values) |
self.dbf.write_record(record, values) |
258 |
self.dbf.commit() |
self.dbf.commit() |
259 |
|
|
260 |
|
def FileName(self): |
261 |
|
"""Return the filename the DBFTable was instantiated with""" |
262 |
# Temporary backwards compatibility |
return self.filename |
|
Table = DBFTable |
|
|
|
|
263 |
|
|
264 |
|
|
265 |
class MemoryColumn: |
class MemoryColumn: |
292 |
self.column_map[name] = col |
self.column_map[name] = col |
293 |
self.column_map[index] = col |
self.column_map[index] = col |
294 |
|
|
295 |
|
def Title(self): |
296 |
|
"""Return 'MemoryTable' |
297 |
|
|
298 |
|
Override in derived classes to have a more meaningful title. |
299 |
|
""" |
300 |
|
return "MemoryTable" |
301 |
|
|
302 |
def NumColumns(self): |
def NumColumns(self): |
303 |
"""Return the number of columns in the table""" |
"""Return the number of columns in the table""" |
304 |
return len(self.columns) |
return len(self.columns) |
365 |
values.sort() |
values.sort() |
366 |
return values |
return values |
367 |
|
|
368 |
|
def Dependencies(self): |
369 |
|
"""Return an empty sequence. The MemoryTable doesn't depend on anything |
370 |
|
""" |
371 |
|
return () |
372 |
|
|
373 |
def write_record(self, record, values): |
def write_record(self, record, values): |
374 |
# TODO: Check for correct lenght and perhaps also |
# TODO: Check for correct lenght and perhaps also |