/[gnue]/gnue-common/src/datasources/GDataObjects.py
ViewVC logotype

Diff of /gnue-common/src/datasources/GDataObjects.py

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

revision 1.68 by siesel, Tue Apr 29 19:25:16 2003 UTC revision 1.69 by jcater, Thu Jul 17 05:24:17 2003 UTC
# Line 365  class ResultSet: Line 365  class ResultSet:
365        pass        pass
366    
367      if record >= len(self._cachedRecords):      if record >= len(self._cachedRecords):
368        return 0        return None
369      else:      else:
370        self._currentRecord = record        self._currentRecord = record
371        self.current = self._cachedRecords[self._currentRecord]        self.current = self._cachedRecords[self._currentRecord]
372        self.notifyDetailObjects()        self.notifyDetailObjects()
373        return 1        return self.current
374    
375    # returns 1=New record loaded, 0=No more records    # returns 1=New record loaded, 0=No more records
376    def nextRecord(self):    def nextRecord(self):
377      if self._currentRecord + 1 == len(self._cachedRecords):      if self._currentRecord + 1 == len(self._cachedRecords):
378        if not self._cacheNextRecord():        if not self._cacheNextRecord():
379          return 0          return None
380    
381      self._currentRecord += 1      self._currentRecord += 1
382      self.current = self._cachedRecords[self._currentRecord]      self.current = self._cachedRecords[self._currentRecord]
383      self.notifyDetailObjects()      self.notifyDetailObjects()
384      return 1      return self.current
385    
386    
387    # returns 1=New record loaded, 0=At first record    # returns 1=New record loaded, 0=At first record
388    def prevRecord(self):    def prevRecord(self):
389      if self._currentRecord < 1:      if self._currentRecord < 1:
390        return 0        return None
391      else:      else:
392        self._currentRecord -= 1        self._currentRecord -= 1
393        self.current = self._cachedRecords[self._currentRecord]        self.current = self._cachedRecords[self._currentRecord]
394        self.notifyDetailObjects()        self.notifyDetailObjects()
395        return 1        return self.current
396    
397    
398    # returns 1=at first record, 0=No records loaded    # returns 1=at first record, 0=No records loaded
399    def firstRecord(self):    def firstRecord(self):
400      if self._currentRecord < 0:      if self._currentRecord < 0:
401        if not self._cacheNextRecord():        if not self._cacheNextRecord():
402          return 0          return None
403    
404      self._currentRecord = 0      self._currentRecord = 0
405      self.current = self._cachedRecords[0]      self.current = self._cachedRecords[0]
406      self.notifyDetailObjects()      self.notifyDetailObjects()
407      return 1      return self.current
408    
409    
410    
411    # returns 1=at last record, 0=No records loaded    # returns 1=at last record, 0=No records loaded
412    def lastRecord(self):    def lastRecord(self):
413      if self._currentRecord == -1:      if self._currentRecord == -1:
414        return 0        return None
415      else:      else:
416        while self._cacheNextRecord():        while self._cacheNextRecord():
417          pass          pass
418        self._currentRecord = len(self._cachedRecords) - 1        self._currentRecord = len(self._cachedRecords) - 1
419        self.current = self._cachedRecords[self._currentRecord]        self.current = self._cachedRecords[self._currentRecord]
420        self.notifyDetailObjects()        self.notifyDetailObjects()
421        return 1        return self.current
422    
423    
424    
# Line 451  class ResultSet: Line 451  class ResultSet:
451            i += 1            i += 1
452    
453        self.notifyDetailObjects()        self.notifyDetailObjects()
454        return 1        return self.current
455    
456    
457    # Returns 1=DataObject, or a detail resultset, has uncommitted changes    # Returns 1=DataObject, or a detail resultset, has uncommitted changes
# Line 595  class RecordSet: Line 595  class RecordSet:
595        self._fields = {}        self._fields = {}
596        self._fields.update(defaultData)        self._fields.update(defaultData)
597    
598      def __setitem__(self, attr, val):
599        self.setField(attr, val)
600    
601      def __getitem__(self, attr):
602        return self.getField(attr)
603    
604    # Returns 1=Record has uncommitted changes    # Returns 1=Record has uncommitted changes
605    def isPending(self):    def isPending(self):
606    
# Line 678  class RecordSet: Line 684  class RecordSet:
684              self._parent._dataObject._dataSource._onModification(self)              self._parent._dataObject._dataSource._onModification(self)
685            except AttributeError:            except AttributeError:
686              pass              pass
687        return value
688    
689    # Batch mode of above setField method    # Batch mode of above setField method
690    # If trackMod is set to 0 then the modification flag isn't raised    # If trackMod is set to 0 then the modification flag isn't raised

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.69

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26