On Wednesday, January 05, 2011 07:42:30 am Nate Lowrie wrote: > dabo Commit > Revision 6307 > Date: 2011-01-05 07:42:30 -0800 (Wed, 05 Jan 2011) > Author: Nate > Trac: http://trac.dabodev.com/changeset/6307 > > Changed: > U trunk/dabo/db/dCursorMixin.py > > Log: > This commit should fix DBQueryException SQL syntax error near parameter > placeholder '%s' reported by me and some other users. The issue is was > when requery would be called for the first time on a parent with CHILD > bizobjs, the child bizobj's requery would get called. The requery would > get the data structure first before re-querying. When we construct the > sql for getting the structure, we temporarily unset the where and limit > clauses, but we never take care of the child filter in the where clause. > This caused an error because we don't pass in any parameters when getting > the structure. > > To fix the problem, I added in an optional parameter for ignoring the child > filter. > > Diff: > Modified: trunk/dabo/db/dCursorMixin.py > =================================================================== > --- trunk/dabo/db/dCursorMixin.py 2011-01-03 01:38:04 UTC (rev 6306) > +++ trunk/dabo/db/dCursorMixin.py 2011-01-05 15:42:30 UTC (rev 6307) > @@ -281,13 +281,13 @@ > if ok: > # change self.Encoding > and log the message > ## pkm 2010-10-21: I > think that mismatched encoding should be > treated as exceptional, - > ## and shouldn't trigger > changing the cursor Encoding which should + > ## and > shouldn't trigger changing the cursor Encoding which should ## > have been set based on what the database reported (currently it is ## > not set that way, but I hope it will be in the future). But > it is ## nice to at least try some different common > encodings if the default ## one doesn't work, especially > since Dabo currently allows non-utf8-encoded ## bytes to > get saved to the database. > - #self.Encoding = enc > + #self.Encoding = enc > dabo.log.error(_("Field > %(fname)s: Incorrect unicode encoding set; > using '%(enc)s' instead") % {'fname':field_name, 'enc':enc} ) > return ret > @@ -1044,7 +1044,7 @@ > if old_key in self._newRecords: > self._newRecords[keyFieldValue] > = self._newRecords[old_key] > del self._newRecords[old_key] > - # Should't ever happen, but > just in case of desynchronization. > + # Should't ever happen, but > just in case of desynchronization. > if kons.CURSOR_TMPKEY_FIELD in > rec: > > rec[kons.CURSOR_TMPKEY_FIELD] = keyFieldValue > elif self._compoundKey: > @@ -2390,7 +2390,7 @@ > return ret > > > - def getSQL(self): > + def getSQL(self, ignoreChildFilter=False): > """ Get the complete SQL statement from all the parts.""" > fieldClause = self.sqlManager._fieldClause > fromClause = self.sqlManager._fromClause > @@ -2407,7 +2407,7 @@ > if not fromClause: > fromClause = self.Table > > - if childFilterClause: > + if childFilterClause and not ignoreChildFilter: > # Prepend it to the where clause > if whereClause: > childFilterClause += "\nand " > @@ -2443,7 +2443,7 @@ > self.sqlManager.setWhereClause("") > holdLimit = self.sqlManager._limitClause > self.sqlManager.setLimitClause(1) > - ret = self.sqlManager.getSQL() > + ret = self.sqlManager.getSQL(ignoreChildFilter=True) > self.sqlManager.setWhereClause(holdWhere) > self.sqlManager.setLimitClause(holdLimit) > return ret > Sweet - I reported it but had no time to fix it. I'll close my ticket Thanks.
Johnf _______________________________________________ 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]
