/[gnue]/gnue-common/src/datasources/drivers/interbase/interbase/DataObject.py
ViewVC logotype

Diff of /gnue-common/src/datasources/drivers/interbase/interbase/DataObject.py

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

revision 1.1 by jcater, Fri Oct 10 01:21:19 2003 UTC revision 1.2 by jcater, Tue Nov 25 17:01:37 2003 UTC
# Line 0  Line 1 
1    #
2    # This file is part of GNU Enterprise.
3    #
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.
8    #
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.
13    #
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.
18    #
19    # Copyright 2000-2003 Free Software Foundation
20    #
21    # FILE:
22    # interbase/DBdriver.py
23    #
24    # DESCRIPTION:
25    # Driver to provide access to data via the Kinterbasdb Interbase/Firebird Python Driver
26    # Requires Kinterbasdb > 3.0 (http://kinterbasdb.sourceforge.net/)
27    #
28    # NOTES:
29    
30    
31    import sys
32    from gnue.common.datasources import GDataObjects
33    from gnue.common.apps import GDebug
34    from gnue.common.datasources.drivers import DBSIG2
35    
36    class _Base(DBSIG2.DataObject):  
37      # The date/time format used in insert/select statements
38      # (based on format used for time.strftime())
39      _dateTimeFormat = "cast('%Y-%m-%d %H:%M:%S' as timestamp)"
40    
41      def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None,sql=""):
42    
43        # Used by drivers with a unique id (like rowid)
44        if not self._primaryIdChecked: self._checkForPrimaryId()
45    
46        try:
47          cursor = self._dataConnection.cursor()
48    
49          cursor.arraysize = self.cache
50          cursor.execute(self._buildQuery(conditions, additionalSQL=sql))
51    
52          # pull a record count
53          if self._strictQueryCount:
54    #        recordCount = cursor.rowcount
55    #        #disable the count query and see if anyone screams
56    #        #recordCount = self._getQueryCount(conditions,sql)
57    
58            #kinterbasdb screams :(
59            recordCount = self._getQueryCount(conditions,sql)
60            
61        except self._DatabaseError, err:
62          raise GDataObjects.ConnectionError, err
63    
64        rs = self._resultSetClass(self, cursor=cursor, masterRecordSet=masterRecordSet)
65        if self._strictQueryCount:
66          rs._recordCount = recordCount
67        if readOnly:
68          rs._readonly = readOnly
69    
70        return rs
71    
72    
73    class DataObject_Object(_Base, DBSIG2.DataObject_Object):
74      pass
75    
76    class DataObject_SQL(_Base, DBSIG2.DataObject_SQL):
77      pass

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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