Author: johannes
Date: 2007-05-05 13:28:31 -0500 (Sat, 05 May 2007)
New Revision: 9551
Modified:
trunk/gnue-common/src/datasources/GDataSource.py
trunk/gnue-common/src/datasources/drivers/Base/Connection.py
Log:
Added rowid attribute to datasources for those backend not supporting a
rowid field by default (like mysql)
Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py 2007-05-05 17:59:06 UTC (rev 9550)
+++ trunk/gnue-common/src/datasources/GDataSource.py 2007-05-05 18:28:31 UTC (rev 9551)
@@ -111,6 +111,7 @@
# Rowid field name
self.__rowidField = None
+ self.__exp_rowid = None
# Condition from <conditions> child
self.__staticCondition = None
@@ -267,6 +268,9 @@
# Make sure the primary key is included in the field references
self.referenceFields (self.__primarykeyFields)
+ if hasattr(self, 'rowid'):
+ self.__exp_rowid = self.rowid
+
# <condition> child: set self.__staticCondition
self.__staticCondition = self.findChildOfType ('GCCondition')
@@ -313,7 +317,7 @@
self.referenceFields (self.__primarykeyFields)
# Include the rowid in list of field references
- rowidField = self._connection._rowidField_
+ rowidField = self._connection._rowidField_ or self.__exp_rowid
if rowidField:
# TODO: checks if the rowid is available and should be used go here:
# 1. if primary key should be prefered, don't set self.__rowidField
@@ -1126,6 +1130,11 @@
'backends that support sequences; requires '
'a single {primarykey} value.'),
'Typecast': GTypecast.text },
+ 'rowid': {
+ 'Label': u_('Row-ID field'),
+ 'Description': u_('Name of the field to use as Row-ID if the '
+ 'connection does not support row ids.'),
+ 'Typecast': GTypecast.text },
'requery': {
'Label': u_('Re-query on commit?'),
'Default': True,
Modified: trunk/gnue-common/src/datasources/drivers/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Connection.py 2007-05-05 17:59:06 UTC (rev 9550)
+++ trunk/gnue-common/src/datasources/drivers/Base/Connection.py 2007-05-05 18:28:31 UTC (rev 9551)
@@ -27,7 +27,7 @@
__all__ = ['Connection']
-from gnue.common.apps import GDebug
+from gnue.common.apps import GDebug, plugin
from gnue.common.datasources import GConnections, GSchema
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.