[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7252 - in trunk/gnue-common/src/datasources: . drivers/DBSIG2
From: |
reinhard |
Subject: |
[gnue] r7252 - in trunk/gnue-common/src/datasources: . drivers/DBSIG2 |
Date: |
Thu, 24 Mar 2005 14:30:15 -0600 (CST) |
Author: reinhard
Date: 2005-03-24 14:30:13 -0600 (Thu, 24 Mar 2005)
New Revision: 7252
Modified:
trunk/gnue-common/src/datasources/GDataSource.py
trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
Log:
Still select * from table even if a field has been automatically referenced
(e.g. primarykey or rowid).
Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py 2005-03-22 20:28:49 UTC
(rev 7251)
+++ trunk/gnue-common/src/datasources/GDataSource.py 2005-03-24 20:30:13 UTC
(rev 7252)
@@ -53,6 +53,8 @@
self._connections = None
self._dataObject = None
self._connectionComment = ""
+ self._hasFieldReferences = False # True if any fields are referenced,
+ # otherwise a "SELECT *" will be used
self._fieldReferences = {}
self._unboundFieldReferences = {}
self._defaultValues = {}
@@ -124,7 +126,7 @@
if len(self.explicitfields):
for field in string.split(self.explicitfields,','):
gDebug (7, "Explicit field %s" % field)
- self._fieldReferences[field] = True
+ self.referenceField (field)
except AttributeError:
pass
@@ -281,6 +283,7 @@
self.name = string.lower(self.name)
self._topObject._datasourceDictionary[self.name]=self
+ dataObject._hasFieldReferences = self._hasFieldReferences
dataObject._fieldReferences = self._fieldReferences
dataObject._unboundFieldReferences = self._unboundFieldReferences
dataObject._defaultValues = self._defaultValues
@@ -332,6 +335,7 @@
def referenceField(self, field, defaultValue=None):
gDebug (7, 'Field %s implicitly referenced' % field)
+ self._hasFieldReferences = True
self._fieldReferences[field] = ""
if defaultValue != None:
Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
2005-03-22 20:28:49 UTC (rev 7251)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
2005-03-24 20:30:13 UTC (rev 7252)
@@ -296,12 +296,25 @@
(join(self._masterfields,","),
join(self._detailfields,","),
self.table, whereClause)
- elif self._fieldReferences:
+
+ elif self._hasFieldReferences:
+ # Explicitly referenced fields give, no need to select *
self._fieldOrder = fields = self._fieldReferences.keys()
q = "SELECT %s%s FROM %s%s" % \
(distinct, join(fields,","), self.table,
whereClause)
+
+ elif self._fieldReferences:
+ # All referenced fields were added in the background (like primarykey or
+ # rowid), so we add * to the query
+ self._fieldOrder = fields = self._fieldReferences.keys()
+ q = "SELECT %s%s, * FROM %s%s" % \
+ (distinct, join(fields,","), self.table,
+ whereClause)
+
else:
+ # No fields at all referenced (neither explicitly nor automatically), so
+ # only select * in the query
self._fieldOrder = []
q = "SELECT %s* FROM %s%s" % (distinct, self.table,
whereClause)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7252 - in trunk/gnue-common/src/datasources: . drivers/DBSIG2,
reinhard <=