/[papo]/gnue/appserver/src/geasList.py
ViewVC logotype

Diff of /gnue/appserver/src/geasList.py

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

revision 1.4 by styxman, Fri Nov 8 16:39:49 2002 UTC revision 1.4.4.1 by anthonyl, Tue Mar 4 22:03:55 2003 UTC
# Line 1  Line 1 
1  # GNU Enterprise Application Server - List Object  # GNU Enterprise Application Server - List Object
2  #  #
3  # Copyright 2001 Free Software Foundation  # Copyright 2001-2003 Free Software Foundation
4  #  #
5  # This file is part of GNU Enterprise.  # This file is part of GNU Enterprise.
6  #  #
# Line 46  class geasList: Line 46  class geasList:
46    # ---------------------------------------------------------------------------    # ---------------------------------------------------------------------------
47    
48    def setPrefetch (self, prefetch):    def setPrefetch (self, prefetch):
49      self._prefetch = prefetch      if type(prefetch)==type(""):
50          self._prefetch = string.split(prefetch,",")
51        elif  type(prefetch)==type([]):
52          self._prefetch = prefetch
53        else:
54          raise Error,"Wrong format of prefetch information."
55            
56    
57    # conditions = an list consisting of condition elements written down in    # conditions = an list consisting of condition elements written down in
# Line 122  class geasList: Line 127  class geasList:
127        return None        return None
128    
129    # ---------------------------------------------------------------------------    # ---------------------------------------------------------------------------
130    # insert a new empty instance in the list and return it    # get the length of the list (the number of entries)
131    # ---------------------------------------------------------------------------    # ---------------------------------------------------------------------------
132    
133    def insertNewInstance (self):    def count (self):
134      self._resultset.insertRecord ()      return self._resultset.getRecordCount ()
     return geasInstance.geasInstance (self, self._resultset.current)  
   
   def getLength(self):  
     pass  
135    
136    def isEmpty(self):    # ---------------------------------------------------------------------------
137      pass    # Fetch data from the database backend
138      # ---------------------------------------------------------------------------
139    
140    def isFirst(self):    def fetch (self, start, count):
141      pass      # negative value for start means starting from the end of the list
142        if start < 0:
143          start = self.count () + start
144        result = []
145        c = 0
146        object = self.firstInstance ()
147        while (object != None) and (c < start + count):
148          if c >= start:
149            row = {}
150            for property in self._prefetch:
151              row [property] = object.get (property)
152            result.append (row)
153          c += 1
154          object = self.nextInstance ()
155        return result
156    
157    def isLast(self):    # ---------------------------------------------------------------------------
158      pass    # insert a new empty instance in the list and return it
159      # ---------------------------------------------------------------------------
160    
161    def previousItem(self):    def insertNewInstance (self):
162      pass      self._resultset.insertRecord ()
163        return geasInstance.geasInstance (self, self._resultset.current)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.4.1

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