1
# GNU Enterprise Datasource Library - Driver for GNUe-AppServer
3
# Copyright 2000-2005 Free Software Foundation
5
# This file is part of GNU Enterprise.
7
# GNU Enterprise is free software; you can redistribute it
8
# and/or modify it under the terms of the GNU General Public
9
# License as published by the Free Software Foundation; either
10
# version 2, or (at your option) any later version.
12
# GNU Enterprise is distributed in the hope that it will be
13
# useful, but WITHOUT ANY WARRANTY; without even the implied
14
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
# PURPOSE. See the GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public
18
# License along with program; see the file COPYING. If not,
19
# write to the Free Software Foundation, Inc., 59 Temple Place
20
# - Suite 330, Boston, MA 02111-1307, USA.
22
# $Id: ResultSet.py 6851 2005-01-03 20:59:28Z jcater $
24
from gnue.common.datasources.drivers import Base
28
# =============================================================================
30
# =============================================================================
32
class ResultSet (Base.ResultSet):
34
Handles a resultset (i.e. a list) in the GNUe-AppServer backend.
36
# This is actually never used
37
_recordSetClass = RecordSet.RecordSet
39
# ---------------------------------------------------------------------------
41
# ---------------------------------------------------------------------------
43
def __init__ (self, dataObject, sm, session_id, list_id, classname,
44
fieldlist, fetchcount, readOnly, masterRecordSet):
46
Base.ResultSet.__init__ (self, dataObject,
47
masterRecordSet = masterRecordSet)
48
self._readOnly = readOnly
51
self.__session_id = session_id
52
self.__list_id = list_id
53
self.__classname = classname
54
self.__fieldlist = fieldlist
55
self.__fetchcount = fetchcount
58
self.__position = 0 # current fetch position in resultset
59
self._recordCount = self.__sm.count (self.__session_id, self.__list_id)
65
# ---------------------------------------------------------------------------
67
# ---------------------------------------------------------------------------
69
def _loadNextRecord (self):
71
if self.__position == -1:
74
records = self.__sm.fetch (self.__session_id,
82
if len (records) < self.__fetchcount:
85
self.__position += len (records)
87
for record in records:
90
for fieldName in ['gnue_id'] + self.__fieldlist:
91
dict [fieldName] = record [j]
94
r = RecordSet.RecordSet (self, self.__sm, self.__session_id,
95
self.__classname, dict)
96
self._cachedRecords.append (r)
100
# ---------------------------------------------------------------------------
101
# Create an empty record
102
# ---------------------------------------------------------------------------
104
def _createEmptyRecord (self):
105
return RecordSet.RecordSet (self, self.__sm, self.__session_id,