Better DictCursor.

This commit is contained in:
Federico Di Gregorio 2005-12-06 05:55:58 +00:00
parent 127c14809c
commit 5ea2fa636f
5 changed files with 22 additions and 1 deletions

View File

@ -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)

View File

@ -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.

View File

@ -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:

View File

@ -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;
}

View File

@ -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);