dabo Commit
Revision 4533
Date: 2008-09-27 06:54:48 -0700 (Sat, 27 Sep 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4533
Changed:
U trunk/dabo/db/dCursorMixin.py
Log:
Fixed the bug that failed to discern that a new record with a
manually-populated PK was in fact new. Thanks to Dr. Sibylle Koczian for
reporting this and working with me to help track it down.
Also fixed a rare bug that would only occur when the SqlManager property
referred to an object other than the cursor itself. Setting the Table property
could result in the two being out of sync.
Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2008-09-26 22:16:18 UTC (rev 4532)
+++ trunk/dabo/db/dCursorMixin.py 2008-09-27 13:54:48 UTC (rev 4533)
@@ -362,7 +362,6 @@
_newQuery=_newQuery)
self._records = dDataSet(_records)
-
if self.RowCount > 0:
self.RowNumber = max(0, self.RowNumber)
maxrow = max(0, (self.RowCount-1) )
@@ -733,9 +732,12 @@
cursor.genTempAutoPK()
cursor.setNewFlag()
"""
+ pk = None
if self.KeyField:
pk = self.getPK()
self._newRecords[pk] = None
+ # Add the 'new record' flag
+ self._records[self.RowNumber][kons.CURSOR_TMPKEY_FIELD] = pk
def genTempAutoPK(self):
@@ -1166,7 +1168,7 @@
def __saverow(self, row):
rec = self._records[row]
recKey = self.pkExpression(rec)
- newrec = self._newRecords.has_key(recKey)
+ newrec = kons.CURSOR_TMPKEY_FIELD in rec
newPKVal = None
if newrec and self.AutoPopulatePK:
# Some backends do not provide a means to retrieve
@@ -2352,8 +2354,8 @@
return self._table
def _setTable(self, table):
- self._table = self.AuxCursor._table = str(table)
- if not self._keyFieldSet:
+ self._table = self.AuxCursor._table = self.sqlManager._table =
"%s" % table
+ if table and not self._keyFieldSet:
# Get the PK field, if any
try:
self._keyField = [fld[0] for fld in
self.getFields(table)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]