From: <no...@so...> - 2002-09-08 14:32:46
|
Feature Requests item #481716, was opened at 2001-11-14 16:35 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=366528&aid=481716&group_id=16528 Category: None Group: None Status: Open Priority: 3 Submitted By: Sergei Barbarash (sgt) Assigned to: Billy G. Allie (ballie01) Summary: PgResultSet: more dict behaviour Initial Comment: Would be nice if PgResultSet emulated more of the regular Python dictionary behaviour - like method get(key, default_value) or method __del__. BTW, why not use UserDict? ---------------------------------------------------------------------- >Comment By: Gerhard Häring (ghaering) Date: 2002-09-08 16:32 Message: Logged In: YES user_id=163326 Because of the optimization I did for PgResultSet, we cannot support __delitem__. I just made a few changes to PgResultSet that I'll commit shortly. Among them is that using a default value for get() is now supported. ---------------------------------------------------------------------- Comment By: Billy G. Allie (ballie01) Date: 2001-11-15 19:11 Message: Logged In: YES user_id=8500 As to why I didn't use one the available dictionary wrappers: basicly, I wanted more capability than just being able to access the results as a dictionary (i.e. being able to access results via the column name as an attribute to the result set). Also, the result set contains a copy of the cursor.description attribute (accessable via the description method of the result set). This makes the result set a stand-alone object once it's created. You don't need the cursor to access the information that is in the description. You can also slice data out of the result set and the description information for the sliced columns is in the resulting result set. BTW: You can always tell PgSQL to return a Python list instead of a pgResultSet and use the various dictionary wrappers to provide the dictionary access. ---------------------------------------------------------------------- Comment By: Sergei Barbarash (sgt) Date: 2001-11-14 16:43 Message: Logged In: YES user_id=58905 err I meant __delitem__ <code> def get(self, key, default): if self.has_key(key): return self[key] else: return default def __delitem__(self, key): del self._xlatkey[key] </code> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=366528&aid=481716&group_id=16528 |