2
# This file is part of GNU Enterprise.
4
# GNU Enterprise is free software; you can redistribute it
5
# and/or modify it under the terms of the GNU General Public
6
# License as published by the Free Software Foundation; either
7
# version 2, or (at your option) any later version.
9
# GNU Enterprise is distributed in the hope that it will be
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public
15
# License along with program; see the file COPYING. If not,
16
# write to the Free Software Foundation, Inc., 59 Temple Place
17
# - Suite 330, Boston, MA 02111-1307, USA.
19
# Copyright 2001-2005 Free Software Foundation
25
# Virtual database driver for a dataless/connectionless client
28
# Primarily used by unbound forms blocks
32
from gnue.common.datasources.drivers.Base import *
35
###########################################################
37
# This is an empty data driver for connectionless clients
38
# (primarily used by forms)
40
###########################################################
41
class NIL_DataObject (DataObject):
43
def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None, sql=""):
44
return NIL_ResultSet(self, masterRecordSet=masterRecordSet)
47
def getLoginFields(self):
50
# We don't do connections (we are connectionless)
51
def connect(self, connectData={}):
58
# And we don't do rollbacks
64
###########################################################
68
###########################################################
69
class NIL_ResultSet(ResultSet):
71
def __init__(self, dataObject, cursor=None, defaultValues={}, masterRecordSet=None):
72
ResultSet.__init__(self, dataObject, \
73
cursor, defaultValues, masterRecordSet)
74
self._recordSetClass = NIL_RecordSet
77
# Returns 1=DataObject has uncommitted changes
79
return 0 # Empty DataObjects cannot have pending changes :)
81
# Post changes to the database
83
# Leave this here in case (for some bizarro reason)
84
# a bound dataobject uses us as a master
85
for record in (self._cachedRecords):
88
# Returns 1=Field is bound to a database field
89
def isFieldBound(self, fieldName):
92
# Load cacheCount number of new records
93
def _loadNextRecord(self):
97
# Create an empty record
98
def _createEmptyRecord(self):
99
return self._recordSetClass(self)
102
###########################################################
106
###########################################################
107
class NIL_RecordSet (RecordSet):
112
# Post any changes to database
113
def _postChanges(self, recordNumber=None):
119
# Extensions to Trigger Namespaces
121
class TriggerExtensions:
122
def __init__(self, connection):
123
self.__connection = connection
127
######################################
129
# The following hashes describe
130
# this driver's characteristings.
132
######################################
135
# All datasouce "types" and corresponding DataObject class
137
supportedDataObjects = {
138
'object': NIL_DataObject