diff options
author | Federico Di Gregorio <fog@initd.org> | 2005-12-06 05:55:58 +0000 |
---|---|---|
committer | Federico Di Gregorio <fog@initd.org> | 2005-12-06 05:55:58 +0000 |
commit | 5ea2fa636fa43eecf8d5d8f2d4b826f077fc1bcb (patch) | |
tree | fc4bd824258adc068fc76856539e7072040c2fe6 | |
parent | 127c14809cb0c04d8b1a291c2306d95181b9dc45 (diff) | |
download | psycopg2-5ea2fa636fa43eecf8d5d8f2d4b826f077fc1bcb.tar.gz |
Better DictCursor.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | LICENSE | 8 | ||||
-rw-r--r-- | lib/extras.py | 6 | ||||
-rw-r--r-- | psycopg/cursor_type.c | 2 | ||||
-rw-r--r-- | psycopg/pqpath.c | 2 |
5 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2005-12-06 Federico Di Gregorio <fog@initd.org> + + * lib/extras.py: added .callproc() to DictCursor as suggested + by Philip Semanchuk. + 2005-11-29 Federico Di Gregorio <fog@initd.org> * MANIFEST.in: added docs/async.txt. (Closes: #75) @@ -50,3 +50,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +Proprietary licenses +==================== + +A non-discriminatory license is available for companies that want to include +psycopg in their proprietary products without respecting the spirit of the +GPL. The price of the license is one day of development done by the author, +at the consulting fee he applies to his usual customers at the day of the +request. diff --git a/lib/extras.py b/lib/extras.py index 39adf0c..a69caa2 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -37,6 +37,12 @@ class DictCursor(_cursor): self.index = {} self.__query_executed = 1 return _cursor.execute(self, query, vars, async) + + def callproc(self, procname, vars=None): + self.row_factory = DictRow + self.index = {} + self.__query_executed = 1 + return _cursor.callproc(self, procname, vars) def _build_index(self): if self.__query_executed == 1 and self.description: diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 6f84ca4..2aadc78 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -881,7 +881,7 @@ psyco_curs_callproc(cursorObject *self, PyObject *args, PyObject *kwargs) if (self->name != NULL) { PyErr_SetString(ProgrammingError, - "can't call .executemany() on named cursors"); + "can't call .callproc() on named cursors"); return NULL; } diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 111069f..4ee8781 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -815,6 +815,7 @@ pq_fetch(cursorObject *curs) else #endif ex = _pq_copy_out(curs); + curs->rowcount = -1; /* error caught by out glorious notice handler */ if (PyErr_Occurred()) ex = -1; IFCLEARPGRES(curs->pgres); @@ -828,6 +829,7 @@ pq_fetch(cursorObject *curs) else #endif ex = _pq_copy_in(curs); + curs->rowcount = -1; /* error caught by out glorious notice handler */ if (PyErr_Occurred()) ex = -1; IFCLEARPGRES(curs->pgres); |