[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7173 - trunk/gnue-common/src/datasources/drivers/Base
From: |
reinhard |
Subject: |
[gnue] r7173 - trunk/gnue-common/src/datasources/drivers/Base |
Date: |
Fri, 11 Mar 2005 13:30:38 -0600 (CST) |
Author: reinhard
Date: 2005-03-11 13:30:37 -0600 (Fri, 11 Mar 2005)
New Revision: 7173
Modified:
trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
Log:
Only set default values and foreign keys for inserted records, only post
pending records.
Modified: trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2005-03-11
19:04:18 UTC (rev 7172)
+++ trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2005-03-11
19:30:37 UTC (rev 7173)
@@ -368,32 +368,32 @@
while recordPosition < len(self._cachedRecords):
self._postingRecord = self._cachedRecords[recordPosition]
postingRecordset = self._postingRecord
- delete = self._postingRecord.isEmpty() or self._postingRecord.isDeleted()
- if not delete:
+
+ if self._postingRecord.isInserted ():
# Flip the flag for 'default' values to true so that hidden
# default fields are included in insert statements
- if self._postingRecord.isPending():
- for field in self._dataObject._defaultValues.keys():
- self._postingRecord._modifiedFlags[field] = True
+ # FIXME: should be handled by RecordSet itself via defaultData param
+ for field in self._dataObject._defaultValues.keys():
+ self._postingRecord._modifiedFlags[field] = True
- for field in foreign_keys.keys():
- self._postingRecord._fields[field] = foreign_keys[field]
- # Some DBs will throw an exception if you update a Primary Key
- # (even if you are updating to the same value)
- if self._postingRecord.isInserted():
- self._postingRecord._modifiedFlags[field] = True
+ # Set the foreign key fields we've got from our master. This must be
+ # done here because the primary key of the master might have been
+ # generated just before.
+ self._postingRecord.setFields (foreign_keys)
- recordPosition += 1
- else:
- # Adjust the current record if a preceding record
- # or the current record is deleted
+ if self._postingRecord.isEmpty () or self._postingRecord.isDeleted ():
+ # Adjust the current record if a preceding record or the current record
+ # is deleted
if recordPosition <= self._currentRecord:
self._currentRecord -= 1
- self._cachedRecords.pop(recordPosition)
+ self._cachedRecords.pop (recordPosition)
self._recordCount -= 1
-
- self._postingRecord.post(recordPosition)
+ else:
+ recordPosition += 1
+ if self._postingRecord.isPending ():
+ self._postingRecord.post (recordPosition)
+
# Move to record 0 if all preceding records were deleted
# (or set to -1 if all records were deleted)
if self._currentRecord < 0:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7173 - trunk/gnue-common/src/datasources/drivers/Base,
reinhard <=