/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/table.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/table.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 466 by bh, Thu Aug 29 11:21:52 2002 UTC revision 467 by jonathan, Wed Mar 5 18:18:38 2003 UTC
# Line 12  Classes for handling tables of data. Line 12  Classes for handling tables of data.
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
# Line 75  class Table: Line 76  class Table:
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          """          """
# Line 100  class Table: Line 111  class Table:
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    

Legend:
Removed from v.466  
changed lines
  Added in v.467

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26