summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2005-12-06 05:55:58 +0000
committerFederico Di Gregorio <fog@initd.org>2005-12-06 05:55:58 +0000
commit5ea2fa636fa43eecf8d5d8f2d4b826f077fc1bcb (patch)
treefc4bd824258adc068fc76856539e7072040c2fe6
parent127c14809cb0c04d8b1a291c2306d95181b9dc45 (diff)
downloadpsycopg2-5ea2fa636fa43eecf8d5d8f2d4b826f077fc1bcb.tar.gz
Better DictCursor.
-rw-r--r--ChangeLog5
-rw-r--r--LICENSE8
-rw-r--r--lib/extras.py6
-rw-r--r--psycopg/cursor_type.c2
-rw-r--r--psycopg/pqpath.c2
5 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 20a66ce..2af437b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/LICENSE b/LICENSE
index 46ba5fe..381fdd9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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);