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 |
|
# adodbapi/DataObject.py |
23 |
|
# |
24 |
|
# DESCRIPTION: |
25 |
|
# Driver to provide access to data via adodbapi Driver |
26 |
|
# |
27 |
|
# NOTES: |
28 |
|
# |
29 |
|
|
30 |
|
__all__ = ['DataObject'] |
31 |
|
|
32 |
|
from gnue.common.datasources import GDataObjects, GConditions, GConnections |
33 |
|
from gnue.common.apps import GDebug |
34 |
|
from gnue.common.datasources.drivers import DBSIG2 |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
class DataObject_Object(DBSIG2.DataObject_Object): |
39 |
|
|
40 |
|
def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None,sql=""): |
41 |
|
|
42 |
|
# Used by drivers with a unique id (like rowid) |
43 |
|
if not self._primaryIdChecked: self._checkForPrimaryId() |
44 |
|
|
45 |
|
try: |
46 |
|
cursor = self._dataConnection.cursor() |
47 |
|
|
48 |
|
cursor.arraysize = self.cache |
49 |
|
cursor.execute(self._buildQuery(conditions, additionalSQL=sql)) |
50 |
|
|
51 |
|
# pull a record count |
52 |
|
if self._strictQueryCount: |
53 |
|
# #disable the count query and see if anyone screams |
54 |
|
# recordCount = cursor.rowcount |
55 |
|
|
56 |
|
#adodbapi screams :( |
57 |
|
recordCount = self._getQueryCount(conditions,sql) |
58 |
|
|
59 |
|
except self._DatabaseError, err: |
60 |
|
raise GDataObjects.ConnectionError, err |
61 |
|
|
62 |
|
rs = self._resultSetClass(self, cursor=cursor, masterRecordSet=masterRecordSet) |
63 |
|
if self._strictQueryCount: |
64 |
|
rs._recordCount = recordCount |
65 |
|
if readOnly: |
66 |
|
rs._readonly = readOnly |
67 |
|
|
68 |
|
return rs |
69 |
|
|
70 |
|
DataObject_SQL = DBSIG2.DataObject_SQL |