From: Gerhard H?r. <gha...@us...> - 2002-12-13 11:30:14
|
Update of /cvsroot/pypgsql/pypgsql In directory sc8-pr-cvs1:/tmp/cvs-serv23826 Modified Files: pgconnection.c Log Message: 13DEC2002 gh In case PQgetResult returns NULL, let libPQgetResult return a Python None, like the docstring says. This is necessary in order to be able to cancel queries, as after cancelling a query with PQrequestCancel, we need to read results until PQgetResult returns NULL. Index: pgconnection.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pgconnection.c 3 Nov 2001 19:02:53 -0000 1.16 --- pgconnection.c 13 Dec 2002 11:30:11 -0000 1.17 *************** *** 29,32 **** --- 29,37 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 13DEC2002 gh In case PQgetResult returns NULL, let libPQgetResult | + | return a Python None, like the docstring says. This is | + | necessary in order to be able to cancel queries, as | + | after cancelling a query with PQrequestCancel, we need | + | to read results until PQgetResult returns NULL. | | 03NOV2001 bga Fixed a possible memory leak. | | 17OCT2001 bga Added the lo_export() method. It was overlooked in the | *************** *** 400,403 **** --- 405,414 ---- res = PQgetResult(PgConnection_Get(self)); + + if (res == NULL) + { + Py_INCREF(Py_None); + return Py_None; + } if ((rtype = getResultType(res)) == RESULT_ERROR) |