/[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 286 by bh, Thu Aug 29 11:21:52 2002 UTC revision 590 by bh, Wed Apr 2 15:03:19 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 38  class Table: Line 38  class Table:
38      # important that Thuban can work with read-only files. Therefore the      # important that Thuban can work with read-only files. Therefore the
39      # DBF file is opened only for reading initially. Only when      # DBF file is opened only for reading initially. Only when
40      # write_record is called we try to open the DBF file for writing as      # write_record is called we try to open the DBF file for writing as
41      # well. If that succeeds the dbf read/write DBF file will be used      # well. If that succeeds the read/write DBF file will be used for
42      # for all IO afterwards.      # all IO afterwards.
43      #      #
44      # It's important to use the same DBF file object for both reading      # It's important to use the same DBF file object for both reading
45      # and writing to make sure that reading a records after writing      # and writing to make sure that reading a records after writing
# Line 75  class Table: Line 75  class Table:
75          type = dbflib_fieldtypes[type]          type = dbflib_fieldtypes[type]
76          return type, name, width, prec          return type, name, width, prec
77    
78        def field_info_by_name(self, fieldName):
79            count = self.field_count()
80    
81            for i in range(count):
82                info = self.field_info(i)
83                if info[1] == fieldName:
84                    return info
85    
86            return None
87    
88      def read_record(self, record):      def read_record(self, record):
89          """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
90          """          """
# Line 100  class Table: Line 110  class Table:
110              self._writable = 1              self._writable = 1
111          self.dbf.write_record(record, values)          self.dbf.write_record(record, values)
112          self.dbf.commit()          self.dbf.commit()
113    

Legend:
Removed from v.286  
changed lines
  Added in v.590

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26