You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(52) |
Oct
(21) |
Nov
(10) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(3) |
Feb
(7) |
Mar
|
Apr
(8) |
May
(1) |
Jun
(6) |
Jul
(4) |
Aug
(4) |
Sep
(18) |
Oct
(26) |
Nov
(7) |
Dec
(25) |
2003 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(10) |
Jul
(10) |
Aug
|
Sep
|
Oct
(5) |
Nov
(2) |
Dec
(2) |
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(8) |
Apr
(1) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Billy G. A. <bal...@us...> - 2001-09-07 00:19:29
|
Update of /cvsroot/pypgsql/pypgsql/test/regression In directory usw-pr-cvs1:/tmp/cvs-serv13423 Modified Files: pgresult.py Log Message: 06SEP2001 bga Finished the test cases for PgResult's members. Just have to do test cases for PgResult's methods. Index: pgresult.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgresult.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pgresult.py 2001/09/05 04:53:01 1.2 --- pgresult.py 2001/09/07 00:19:26 1.3 *************** *** 34,37 **** --- 34,39 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 06SEP2001 bga Completed the PgResult Member test cases, just have to | + # do the PgResult Method test cases. | # 04SEP2001 bga Expanded the test cases. Still more to do. | # 02SEP2001 bga Initial release by Billy G. Allie. | *************** *** 46,66 **** version = ((((version[0] * 100) + version[1]) * 100) + version[2]) ! class PgResultMethodTestCases(unittest.TestCase): def setUp(self): ! self.cnx = libpq.PQconnectdb('dbname=pypgsql') ! self.vstr = "%(major)d.%(minor)d" % self.cnx.version.__dict__ self.members = ['binaryTuples', 'cmdStatus', 'cmdTuples', 'nfields', ! 'ntuples', 'oidValue', 'resultErrorMessage', 'resultStatus', 'resultType'] self.methods = ['clear', 'fname', 'fnumber', 'fsize', 'ftype', 'getisnull', 'getlength', 'getvalue'] - - def tearDown(self): - try: - self.cnx.finish() - except AttributeError: - pass - except libpq.InterfaceError: - pass def CheckForMembers(self, res): --- 48,68 ---- version = ((((version[0] * 100) + version[1]) * 100) + version[2]) ! # Get a connection and a version string to be used globally. ! cnx = libpq.PQconnectdb("dbname=pypgsql") ! vstr = "%(major)d.%(minor)d" % cnx.version.__dict__ ! ! class PgResultMemberTestCases(unittest.TestCase): ! def setUp(self): ! global cnx ! global vstr ! ! self.cnx = cnx ! self.vstr = vstr self.members = ['binaryTuples', 'cmdStatus', 'cmdTuples', 'nfields', ! 'ntuples', 'oidValue', 'resultErrorMessage', 'resultStatus', 'resultType'] self.methods = ['clear', 'fname', 'fnumber', 'fsize', 'ftype', 'getisnull', 'getlength', 'getvalue'] def CheckForMembers(self, res): *************** *** 85,89 **** def CheckDropPgResult(self): ! query = "drop table pgresult_test" res = self.cnx.query(query) self.CheckForMembers(res) --- 87,91 ---- def CheckDropPgResult(self): ! query = "DROP TABLE pgresult_test" res = self.cnx.query(query) self.CheckForMembers(res) *************** *** 94,181 **** self.failUnlessRaises(libpq.OperationalError, self.cnx.query, query) ! # def CheckDeclareBinaryPgResult(self): ! # res = self.cnx.query("""declare pgres_bin_cursor cursor as ! # select * from pgresult_test"""); ! # self.CheckForMembers(res) ! # self.CheckForMethods(res) ! # self.assertEquals(res.binaryTuples, 0, ! # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) ! # self.assertEquals(res.cmdStatus, 'SELECT', ! # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) ! # self.assertEquals(res.cmdTuples, None, ! # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) ! # self.assertEquals(res.ntuples, 1, ! # "PgResult.ntuples is %d, should be 1." % res.ntuples) ! # self.assertEquals(res.nfields, 7, ! # "PgResult.nfields is %d, should be 1." % res.nfields) ! # self.assertEquals(res.resultErrorMessage, None, ! # "PgResult.resultErrorMessage is '%s', should be None." % \ ! # res.resultErrorMessage) ! # ! # def CheckFetchBinaryPgResult(self): ! # res = self.cnx.query("fetch 1 from pgres_bin_cursor"); ! # self.CheckForMembers(res) ! # self.CheckForMethods(res) ! # expected = [0, 'SELECT', None, 1, 7, None, 2, 1 ] ! # ! # def CheckDeclarePgResult(self): ! # res = self.cnx.query("""declare pgres_curosr cursor as ! # select * from pgresult_test"""); ! # self.CheckForMembers(res) ! # self.CheckForMethods(res) ! # self.assertEquals(res.binaryTuples, 0, ! # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) ! # self.assertEquals(res.cmdStatus, 'SELECT', ! # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) ! # self.assertEquals(res.cmdTuples, None, ! # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) ! # self.assertEquals(res.ntuples, 1, ! # "PgResult.ntuples is %d, should be 1." % res.ntuples) ! # self.assertEquals(res.nfields, 7, ! # "PgResult.nfields is %d, should be 1." % res.nfields) ! # self.assertEquals(res.resultErrorMessage, None, ! # "PgResult.resultErrorMessage is '%s', should be None." % \ ! # res.resultErrorMessage) ! # ! # def CheckFetchPgResult(self): ! # res = self.cnx.query("""select * from pg_database ! # where datname = 'pypgsql'"""); ! # self.CheckForMembers(res) ! # self.CheckForMethods(res) ! # self.assertEquals(res.binaryTuples, 0, ! # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) ! # self.assertEquals(res.cmdStatus, 'SELECT', ! # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) ! # self.assertEquals(res.cmdTuples, None, ! # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) ! # self.assertEquals(res.ntuples, 1, ! # "PgResult.ntuples is %d, should be 1." % res.ntuples) ! # self.assertEquals(res.nfields, 7, ! # "PgResult.nfields is %d, should be 1." % res.nfields) ! # self.assertEquals(res.resultErrorMessage, None, ! # "PgResult.resultErrorMessage is '%s', should be None." % \ ! # res.resultErrorMessage) ! # ! # def CheckUpdatePgResult(self): ! # res = self.cnx.query("select * from pgresult_test") ! # self.CheckForMembers(res) ! # self.CheckForMethods(res) ! # self.assertEquals(res.binaryTuples, 0, ! # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) ! # self.assertEquals(res.cmdStatus, 'SELECT', ! # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) ! # self.assertEquals(res.cmdTuples, None, ! # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) ! # self.assertEquals(res.ntuples, 1, ! # "PgResult.ntuples is %d, should be 1." % res.ntuples) ! # self.assertEquals(res.nfields, 7, ! # "PgResult.nfields is %d, should be 1." % res.nfields) ! # self.assertEquals(res.resultErrorMessage, None, ! # "PgResult.resultErrorMessage is '%s', should be None." % \ ! # res.resultErrorMessage) ! # def CheckInsertPgResult(self): ! res = self.cnx.query("""insert into pgresult_test ! values (1, 'This is a test (1)')"""); self.CheckForMembers(res) self.CheckForMethods(res) --- 96,201 ---- self.failUnlessRaises(libpq.OperationalError, self.cnx.query, query) ! def CheckEndPgResult(self): ! res = self.cnx.query("END WORK") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'COMMIT', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckCloseBinaryPgResult(self): ! res = self.cnx.query("CLOSE pgres_cursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'CLOSE', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckNoticePgResult(self): ! # The following query will cause a notice to be generated, but not ! # an error. ! res = self.cnx.query("FETCH FROM pgres_cursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'FETCH', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! self.assertEquals(len(self.cnx.notices), 1, ! "A notice should of been generated, none was!") ! n = self.cnx.notices.pop() ! e = 'NOTICE: PerformPortalFetch: portal "pgres_cursor" not found\n' ! self.assertEquals(n, e, "The notice did not match expected results"); ! ! def CheckClosePgResult(self): ! res = self.cnx.query("CLOSE pgres_cursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'CLOSE', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckFetchBinaryPgResult(self): ! res = self.cnx.query("FETCH 3 FROM pgres_bcursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [1, 'FETCH', None, 2, 3, None, None, 2, 1 ] ! self.CheckMemberValues(res, expected) ! ! def CheckDeclareBinaryPgResult(self): ! res = self.cnx.query("""DECLARE pgres_bcursor BINARY CURSOR FOR ! SELECT * FROM pgresult_test""") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'SELECT', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckMovePgResult(self): ! res = self.cnx.query("MOVE BACKWARD ALL IN pgres_cursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'MOVE', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! res = self.cnx.query("FETCH ALL FROM pgres_cursor") ! expected = [0, 'FETCH', None, 2, 4, None, None, 2, 1 ] ! self.CheckMemberValues(res, expected) ! ! def CheckFetchPgResult(self): ! res = self.cnx.query("FETCH 2 FROM pgres_cursor") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'FETCH', None, 2, 2, None, None, 2, 1 ] ! self.CheckMemberValues(res, expected) ! ! def CheckDeclarePgResult(self): ! res = self.cnx.query("""DECLARE pgres_cursor CURSOR FOR ! SELECT * FROM pgresult_test""") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'SELECT', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckBeginPgResult(self): ! res = self.cnx.query("BEGIN WORK") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'BEGIN', None, 0, 0, None, None, 1, 2 ] ! self.CheckMemberValues(res, expected) ! ! def CheckSelectPgResult(self): ! res = self.cnx.query("SELECT * FROM pgresult_test") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! expected = [0, 'SELECT', None, 2, 4, None, None, 2, 1 ] ! self.CheckMemberValues(res, expected) ! ! def CheckUpdatePgResult(self): ! res = self.cnx.query("""UPDATE pgresult_test ! SET f2 = 'This is a test (3u)' ! WHERE f1 = 3""") ! self.CheckForMembers(res) ! self.CheckForMethods(res) ! cs = 'UPDATE %s' % res.cmdTuples ! expected = [0, cs, 1, 0, 0, None, None, 1, 3 ] ! self.CheckMemberValues(res, expected) ! def CheckInsertPgResult(self): ! res = self.cnx.query("""INSERT INTO pgresult_test ! VALUES (1, 'This is a test (1)')""") self.CheckForMembers(res) self.CheckForMethods(res) *************** *** 187,199 **** "PgResult.oidValue is None, it shouldn't be None.") self.CheckMemberValues(res, expected) ! res = self.cnx.query("""insert into pgresult_test ! values (2, 'This is a test (2)')"""); ! res = self.cnx.query("""insert into pgresult_test ! values (3, 'This is a test (3)')"""); ! res = self.cnx.query("""insert into pgresult_test ! values (4, 'This is a test (4)')"""); def CheckCreatePgResult(self): ! query = "create table pgresult_test(f1 int, f2 text)" res = self.cnx.query(query) self.CheckForMembers(res) --- 207,219 ---- "PgResult.oidValue is None, it shouldn't be None.") self.CheckMemberValues(res, expected) ! res = self.cnx.query("""INSERT INTO pgresult_test ! VALUES (2, 'This is a test (2)')""") ! res = self.cnx.query("""INSERT INTO pgresult_test ! VALUES (3, 'This is a test (3)')""") ! res = self.cnx.query("""INSERT INTO pgresult_test ! VALUES (4, 'This is a test (4)')""") def CheckCreatePgResult(self): ! query = "CREATE TABLE pgresult_test(f1 INT, f2 TEXT)" res = self.cnx.query(query) self.CheckForMembers(res) *************** *** 205,209 **** def CheckPgResult(self): ! res = self.cnx.query("select * from pg_database limit 3") self.CheckForMembers(res) self.CheckForMethods(res) --- 225,229 ---- def CheckPgResult(self): ! res = self.cnx.query("SELECT * FROM pg_database LIMIT 3") self.CheckForMembers(res) self.CheckForMethods(res) *************** *** 242,253 **** if __name__ == "__main__": TestSuite = unittest.TestSuite() ! TestSuite.addTest(PgResultMethodTestCases("CheckPgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckCreatePgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckInsertPgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckSelectPgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckUpdatePgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckDeclarePgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckFetchPgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckDropPgResult")) TestSuite.addTest(PgResultTestCases("CheckSelectOfNonPrintableString")) --- 262,282 ---- if __name__ == "__main__": TestSuite = unittest.TestSuite() ! TestSuite.addTest(PgResultMemberTestCases("CheckPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckCreatePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckInsertPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckUpdatePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckSelectPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckBeginPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckDeclarePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckFetchPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckMovePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckDeclareBinaryPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckFetchBinaryPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckClosePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckNoticePgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckCloseBinaryPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckEndPgResult")) ! TestSuite.addTest(PgResultMemberTestCases("CheckDropPgResult")) ! TestSuite.addTest(PgResultTestCases("CheckSelectOfNonPrintableString")) |
From: Billy G. A. <bal...@us...> - 2001-09-06 04:59:29
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv5717 Modified Files: libpqmodule.c Log Message: 06SEP2001 bga Arranged it so that PQconnectStart() is no longer available. It became broken when the creation of the PgVersion object was moved from PgSQL.Connection to libpq.PgConnection, and it's more trouble than it's worth to fix. Also PQconnectStart() is not used by the DB-API 2.0 compatible module (PgSQL.py). Index: libpqmodule.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libpqmodule.c 2001/09/03 05:31:37 1.12 --- libpqmodule.c 2001/09/06 04:59:26 1.13 *************** *** 241,245 **** /*--------------------------------------------------------------------------*/ ! #if !defined(PGSQL_6X) static char libPQconnectStart_Doc[] = "PQconnectStart(conninfo) -> PgConnection\n" --- 241,245 ---- /*--------------------------------------------------------------------------*/ ! #if defined(DO_NOT_DEFINE_THIS_MACRO) static char libPQconnectStart_Doc[] = "PQconnectStart(conninfo) -> PgConnection\n" *************** *** 565,569 **** { "PQconndefaults", (PyCFunction)libPQconndefaults, 1, libPQconndefaults_Doc }, ! #if !defined(PGSQL_6X) { "PQconnectStart", (PyCFunction)libPQconnectStart, 1, libPQconnectStart_Doc }, --- 565,569 ---- { "PQconndefaults", (PyCFunction)libPQconndefaults, 1, libPQconndefaults_Doc }, ! #if defined(DO_NOT_DEFINE_THIS_MACRO) { "PQconnectStart", (PyCFunction)libPQconnectStart, 1, libPQconnectStart_Doc }, |
From: Billy G. A. <bal...@us...> - 2001-09-06 04:42:31
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv2907 Modified Files: pglargeobject.c pgnotify.c pgresult.c pgversion.c Log Message: 06SEP2001 bga Clean up lint-like warning from gcc. Index: pglargeobject.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pglargeobject.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pglargeobject.c 2001/08/31 05:49:00 1.6 --- pglargeobject.c 2001/09/06 04:42:21 1.7 *************** *** 30,33 **** --- 30,34 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 06SEP2001 bga Removed an un-used variable. | | 30AUG2001 bga Use PyObject_Del() instead of PyMem_Free() in dealloc() | | to delete the object. | *************** *** 141,145 **** static PyObject *PgLargeObject_repr(PgLargeObject *self) { - int i; char buf[128], *state, *mode = ""; --- 142,145 ---- Index: pgnotify.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgnotify.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pgnotify.c 2001/08/31 05:49:00 1.5 --- pgnotify.c 2001/09/06 04:42:21 1.6 *************** *** 30,33 **** --- 30,34 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 06SEP2001 bga Clarified an embedded assignment within an if test. | | 30AUG2001 bga Use PyObject_Del() instead of PyMem_Free() in dealloc() | | to delete the object. | *************** *** 60,64 **** self = (PgNotify *)Py_None; } ! else if (self = (PgNotify *)PyObject_New(PgNotify, &PgNotify_Type)) { self->relname = Py_BuildValue("s", &(note->relname)); --- 61,66 ---- self = (PgNotify *)Py_None; } ! else if ((self = (PgNotify *)PyObject_New(PgNotify, &PgNotify_Type)) != ! (PgNotify *)NULL) { self->relname = Py_BuildValue("s", &(note->relname)); Index: pgresult.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgresult.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pgresult.c 2001/09/04 21:24:11 1.7 --- pgresult.c 2001/09/06 04:42:21 1.8 *************** *** 2,8 **** /* vi:set sw=4 ts=8 showmode ai: */ /**(H+)*****************************************************************\ ! | Name: pgconnection.c | | | ! | Description: This file implements the PgConnection Object for Python | |=======================================================================| | Copyright 2001 by Billy G. Allie. | --- 2,8 ---- /* vi:set sw=4 ts=8 showmode ai: */ /**(H+)*****************************************************************\ ! | Name: pgresult.c | | | ! | Description: This file implements the PgResult Object for Python | |=======================================================================| | Copyright 2001 by Billy G. Allie. | *************** *** 29,32 **** --- 29,37 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 06SEP2001 bga Fixed a gcc reported int format <-> long int arguement | + | mis-match. | + | 05SEP2001 bga Added check to make sure that the result was from a DQL | + | (Data Query Language) statement in methods that only | + | make sense for DQL statement results (fname(), etc.). | | 03SEP2001 bga Methods that take field and/or tuple indices will now | | raise an exception if those indices are out of range. | *************** *** 205,208 **** --- 210,233 ---- /*--------------------------------------------------------------------------*/ + static int PgResult_is_DQL(PgResult *self) + { + /*******************************************************************\ + | Since this is only called from within pgresult.c, and we can en- | + | sure that it is only called with a PgResult object, we don't have | + | to check self. | + \*******************************************************************/ + + if (PyInt_AS_LONG(self->type) != RESULT_DQL) + { + PyErr_SetString(PqErr_InterfaceError, + "PgResult object was not generated by a DQL statement"); + return FALSE; + } + + return TRUE; + } + + /*--------------------------------------------------------------------------*/ + static int PgResult_ntuple_check(PgResult *self, int tnum) { *************** *** 217,221 **** char buf[256]; ! sprintf(buf, "tuple index outside valid range of 0..%d.", (PyInt_AS_LONG(self->ntuples) - 1)); PyErr_SetString(PyExc_ValueError, buf); --- 242,246 ---- char buf[256]; ! sprintf(buf, "tuple index outside valid range of 0..%ld.", (PyInt_AS_LONG(self->ntuples) - 1)); PyErr_SetString(PyExc_ValueError, buf); *************** *** 240,244 **** char buf[256]; ! sprintf(buf, "field index outside valid range of 0..%d.", (PyInt_AS_LONG(self->nfields) - 1)); PyErr_SetString(PyExc_ValueError, buf); --- 265,269 ---- char buf[256]; ! sprintf(buf, "field index outside valid range of 0..%ld.", (PyInt_AS_LONG(self->nfields) - 1)); PyErr_SetString(PyExc_ValueError, buf); *************** *** 264,267 **** --- 289,295 ---- return (PyObject *)NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "i:fname", &fnum)) return (PyObject *)NULL; *************** *** 287,290 **** --- 315,321 ---- return (PyObject *)NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "s:fnumber", &fieldName)) return (PyObject *)NULL; *************** *** 315,318 **** --- 346,352 ---- return (PyObject *)NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "i:ftype", &fnum)) return (PyObject *)NULL; *************** *** 340,343 **** --- 374,380 ---- return (PyObject *)NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "i:fsize", &fnum)) return (PyObject *)NULL; *************** *** 363,366 **** --- 400,406 ---- return NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "i:fmod", &fnum)) return NULL; *************** *** 390,393 **** --- 430,436 ---- return NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "ii:getvalue", &tnum, &fnum)) return NULL; *************** *** 597,600 **** --- 640,646 ---- return NULL; + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; + if (!PyArg_ParseTuple(args, "ii:getlength", &tnum, &fnum)) return NULL; *************** *** 622,625 **** --- 668,674 ---- if (!PgResult_check((PyObject *)self)) return NULL; + + if (!PgResult_is_DQL(self)) + return (PyObject *)NULL; if (!PyArg_ParseTuple(args, "ii:getisnull", &tnum, &fnum)) Index: pgversion.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgversion.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pgversion.c 2001/08/29 04:05:35 1.4 --- pgversion.c 2001/09/06 04:42:21 1.5 *************** *** 32,35 **** --- 32,37 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 06SEP2001 bga Initialize a variable (value) in ver_coerce() to quite | + | an erroneous gcc warning message. | | 28AUG2001 bga Picked some lint from the code. | | 24AUG2001 bga Removed a variable that was no longer used/needed. | *************** *** 126,130 **** PgVersion *s; char *vstr; - long value; if (PyString_Check(*r)) --- 128,131 ---- *************** *** 141,144 **** --- 142,147 ---- else { + long value = 0; + if ((vstr = PyMem_Malloc(128)) == (char *)NULL) { |
From: Gerhard H?r. <gha...@us...> - 2001-09-06 03:58:15
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv23156/test Modified Files: PgSQLTestCases.py Log Message: 06SEP2001 gh Fix bug in PgBoolean_FromString: leading whitespace in PgBoolean constructor doesn't lead to segfaults any more; also improve and simplify the string stripping in this method. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PgSQLTestCases.py 2001/09/03 04:43:31 1.11 --- PgSQLTestCases.py 2001/09/06 03:58:13 1.12 *************** *** 140,143 **** --- 140,144 ---- sTrue = PgSQL.PgBooleanFromString('t') sFalse = PgSQL.PgBooleanFromString('f') + sFalse2 = PgSQL.PgBooleanFromString(' faLSe ') except StandardError, msg: self.assert_(0, msg) *************** *** 146,150 **** 'PgBooleanFromInteger failed to create a TRUE value.') self.failIf(iFalse, ! 'PgBooleanFromInteger failed to create a FALSE value.') self.failUnless(sTrue, 'PgBooleanFromString failed to create a TRUE value.') --- 147,153 ---- 'PgBooleanFromInteger failed to create a TRUE value.') self.failIf(iFalse, ! 'PgBooleanFromInteger failed to create a FALSE value (1).') ! self.failIf(iFalse, ! 'PgBooleanFromInteger failed to create a FALSE value (2).') self.failUnless(sTrue, 'PgBooleanFromString failed to create a TRUE value.') *************** *** 658,662 **** self.fail(msg) ! if __name__ == "__main__": TestSuite = unittest.TestSuite() TestSuite.addTest(DBAPICompliance("CheckAPILevel")) --- 661,665 ---- self.fail(msg) ! def main(): TestSuite = unittest.TestSuite() TestSuite.addTest(DBAPICompliance("CheckAPILevel")) *************** *** 718,719 **** --- 721,726 ---- runner = unittest.TextTestRunner() runner.run(TestSuite) + + if __name__ == "__main__": + main() + |
From: Gerhard H?r. <gha...@us...> - 2001-09-06 03:58:15
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv23156 Modified Files: pgboolean.c Log Message: 06SEP2001 gh Fix bug in PgBoolean_FromString: leading whitespace in PgBoolean constructor doesn't lead to segfaults any more; also improve and simplify the string stripping in this method. Index: pgboolean.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgboolean.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pgboolean.c 2001/08/24 22:26:00 1.8 --- pgboolean.c 2001/09/06 03:58:12 1.9 *************** *** 33,36 **** --- 33,38 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 06SEP2001 gh Fix bug in PgBoolean_FromString; also improve and | + | simplify the string stripping in this method. | | 09AUG2001 bga Change code to use Py_BuildValue() for creating Python | | objects from C values (where possible). | *************** *** 78,85 **** PyObject *PgBoolean_FromString(char *s) { ! char *p, *e; PyObject *b = (PyObject *)NULL; ! if ((p = PyMem_Strdup(s)) == (char *)NULL) { PyErr_SetString(PyExc_MemoryError, --- 80,87 ---- PyObject *PgBoolean_FromString(char *s) { ! char *pstart, *p, *e; PyObject *b = (PyObject *)NULL; ! if ((pstart = PyMem_Strdup(s)) == (char *)NULL) { PyErr_SetString(PyExc_MemoryError, *************** *** 87,95 **** return (PyObject *)NULL; } while (*p && isspace(Py_CHARMASK((unsigned int)(*p)))) p++; ! for (e = (p + strlen(p) - 1); e > p; --e) { if (isspace((int)Py_CHARMASK((unsigned int)(*e)))) --- 89,98 ---- return (PyObject *)NULL; } + p = pstart; while (*p && isspace(Py_CHARMASK((unsigned int)(*p)))) p++; ! for (e = p; e < p + strlen(p); e++) { if (isspace((int)Py_CHARMASK((unsigned int)(*e)))) *************** *** 100,104 **** *e = (unsigned char)toupper((int)Py_CHARMASK((unsigned int)(*e))); } - *e = (unsigned char)toupper((int)Py_CHARMASK((unsigned int)(*e))); switch (*p) --- 103,106 ---- *************** *** 142,146 **** } ! PyMem_Free(p); if (b != (PyObject *)NULL) --- 144,148 ---- } ! PyMem_Free(pstart); if (b != (PyObject *)NULL) |
From: Billy G. A. <bal...@us...> - 2001-09-05 04:53:05
|
Update of /cvsroot/pypgsql/pypgsql/test/regression In directory usw-pr-cvs1:/tmp/cvs-serv32312/test/regression Modified Files: pgresult.py Log Message: 04SEP2001 bga Expanded the test cases. Still more to do. Index: pgresult.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgresult.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pgresult.py 2001/09/04 03:38:51 1.1 --- pgresult.py 2001/09/05 04:53:01 1.2 *************** *** 34,37 **** --- 34,38 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 04SEP2001 bga Expanded the test cases. Still more to do. | # 02SEP2001 bga Initial release by Billy G. Allie. | #-----------------------------------------------------------------------+ *************** *** 45,52 **** version = ((((version[0] * 100) + version[1]) * 100) + version[2]) ! class PgResultTestCases(unittest.TestCase): def setUp(self): self.cnx = libpq.PQconnectdb('dbname=pypgsql') self.vstr = "%(major)d.%(minor)d" % self.cnx.version.__dict__ def tearDown(self): --- 46,58 ---- version = ((((version[0] * 100) + version[1]) * 100) + version[2]) ! class PgResultMethodTestCases(unittest.TestCase): def setUp(self): self.cnx = libpq.PQconnectdb('dbname=pypgsql') self.vstr = "%(major)d.%(minor)d" % self.cnx.version.__dict__ + self.members = ['binaryTuples', 'cmdStatus', 'cmdTuples', 'nfields', + 'ntuples', 'oidValue', 'resultErrorMessage', + 'resultStatus', 'resultType'] + self.methods = ['clear', 'fname', 'fnumber', 'fsize', 'ftype', + 'getisnull', 'getlength', 'getvalue'] def tearDown(self): *************** *** 59,71 **** def CheckForMembers(self, res): ! for i in ['binaryTuples', 'cmdStatus', 'cmdTuples', 'nfields', ! 'ntuples', 'oidValue', 'resultErrorMessage', 'resultStatus', ! 'resultType']: self.assert_(i in res.__members__, 'PgResult is missing member "%s".' % i) def CheckForMethods(self, res): ! for i in ['clear', 'fname', 'fnumber', 'fsize', 'ftype', 'getisnull', ! 'getlength', 'getvalue']: self.assert_(i in res.__methods__, 'PgResult is missing method "%s".' % i) --- 65,81 ---- def CheckForMembers(self, res): ! for i in self.members: self.assert_(i in res.__members__, 'PgResult is missing member "%s".' % i) + def CheckMemberValues(self, res, expected): + for i in range(len(self.members)): + exec 'v = res.%s' % self.members[i] + self.assertEquals(v, expected[i], + 'PgResult.%s is %s, it should be %s!' % \ + (self.members[i], v, expected[i])) + def CheckForMethods(self, res): ! for i in self.methods: self.assert_(i in res.__methods__, 'PgResult is missing method "%s".' % i) *************** *** 74,95 **** 'PgResult method %s() is not callable.' % i) def CheckPgResult(self): ! res = self.cnx.query("""select * from pg_database ! where datname = 'pypgsql'"""); self.CheckForMembers(res) self.CheckForMethods(res) ! self.assertEquals(res.binaryTuples, 0, ! "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) ! self.assertEquals(res.cmdStatus, 'SELECT', ! "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) ! self.assertEquals(res.cmdTuples, None, ! "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) ! self.assertEquals(res.ntuples, 1, ! "PgResult.ntuples is %d, should be 1." % res.ntuples) ! self.assertEquals(res.nfields, 7, ! "PgResult.nfields is %d, should be 1." % res.nfields) ! self.assertEquals(res.resultErrorMessage, None, ! "PgResult.resultErrorMessage is '%s', should be None." % \ ! res.resultErrorMessage) def CheckSelectOfNonPrintableString(self): --- 84,228 ---- 'PgResult method %s() is not callable.' % i) + def CheckDropPgResult(self): + query = "drop table pgresult_test" + res = self.cnx.query(query) + self.CheckForMembers(res) + self.CheckForMethods(res) + expected = [0, 'DROP', None, 0, 0, None, None, 1, 2 ] + self.CheckMemberValues(res, expected) + # Try to drop the table again. This should raise an execption. + self.failUnlessRaises(libpq.OperationalError, self.cnx.query, query) + + # def CheckDeclareBinaryPgResult(self): + # res = self.cnx.query("""declare pgres_bin_cursor cursor as + # select * from pgresult_test"""); + # self.CheckForMembers(res) + # self.CheckForMethods(res) + # self.assertEquals(res.binaryTuples, 0, + # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) + # self.assertEquals(res.cmdStatus, 'SELECT', + # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) + # self.assertEquals(res.cmdTuples, None, + # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) + # self.assertEquals(res.ntuples, 1, + # "PgResult.ntuples is %d, should be 1." % res.ntuples) + # self.assertEquals(res.nfields, 7, + # "PgResult.nfields is %d, should be 1." % res.nfields) + # self.assertEquals(res.resultErrorMessage, None, + # "PgResult.resultErrorMessage is '%s', should be None." % \ + # res.resultErrorMessage) + # + # def CheckFetchBinaryPgResult(self): + # res = self.cnx.query("fetch 1 from pgres_bin_cursor"); + # self.CheckForMembers(res) + # self.CheckForMethods(res) + # expected = [0, 'SELECT', None, 1, 7, None, 2, 1 ] + # + # def CheckDeclarePgResult(self): + # res = self.cnx.query("""declare pgres_curosr cursor as + # select * from pgresult_test"""); + # self.CheckForMembers(res) + # self.CheckForMethods(res) + # self.assertEquals(res.binaryTuples, 0, + # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) + # self.assertEquals(res.cmdStatus, 'SELECT', + # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) + # self.assertEquals(res.cmdTuples, None, + # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) + # self.assertEquals(res.ntuples, 1, + # "PgResult.ntuples is %d, should be 1." % res.ntuples) + # self.assertEquals(res.nfields, 7, + # "PgResult.nfields is %d, should be 1." % res.nfields) + # self.assertEquals(res.resultErrorMessage, None, + # "PgResult.resultErrorMessage is '%s', should be None." % \ + # res.resultErrorMessage) + # + # def CheckFetchPgResult(self): + # res = self.cnx.query("""select * from pg_database + # where datname = 'pypgsql'"""); + # self.CheckForMembers(res) + # self.CheckForMethods(res) + # self.assertEquals(res.binaryTuples, 0, + # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) + # self.assertEquals(res.cmdStatus, 'SELECT', + # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) + # self.assertEquals(res.cmdTuples, None, + # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) + # self.assertEquals(res.ntuples, 1, + # "PgResult.ntuples is %d, should be 1." % res.ntuples) + # self.assertEquals(res.nfields, 7, + # "PgResult.nfields is %d, should be 1." % res.nfields) + # self.assertEquals(res.resultErrorMessage, None, + # "PgResult.resultErrorMessage is '%s', should be None." % \ + # res.resultErrorMessage) + # + # def CheckUpdatePgResult(self): + # res = self.cnx.query("select * from pgresult_test") + # self.CheckForMembers(res) + # self.CheckForMethods(res) + # self.assertEquals(res.binaryTuples, 0, + # "PgResult.binaryTuples is %d, should be 0." % res.binaryTuples) + # self.assertEquals(res.cmdStatus, 'SELECT', + # "PgResult.cmdStatus is '%s', should be 'SELECT'." % res.cmdStatus) + # self.assertEquals(res.cmdTuples, None, + # "PgResult.cmdTuples is %s, should be None." % res.cmdTuples) + # self.assertEquals(res.ntuples, 1, + # "PgResult.ntuples is %d, should be 1." % res.ntuples) + # self.assertEquals(res.nfields, 7, + # "PgResult.nfields is %d, should be 1." % res.nfields) + # self.assertEquals(res.resultErrorMessage, None, + # "PgResult.resultErrorMessage is '%s', should be None." % \ + # res.resultErrorMessage) + # + def CheckInsertPgResult(self): + res = self.cnx.query("""insert into pgresult_test + values (1, 'This is a test (1)')"""); + self.CheckForMembers(res) + self.CheckForMethods(res) + # The PgResult object's members can't be tested with CheckMemberValues() + # directly. Set up things so we can call CheckMember Values() + cs = 'INSERT %s %s' % (res.oidValue, res.cmdTuples) + expected = [0, cs, 1, 0, 0, res.oidValue, None, 1, 3 ] + self.assert_(res.oidValue != None, + "PgResult.oidValue is None, it shouldn't be None.") + self.CheckMemberValues(res, expected) + res = self.cnx.query("""insert into pgresult_test + values (2, 'This is a test (2)')"""); + res = self.cnx.query("""insert into pgresult_test + values (3, 'This is a test (3)')"""); + res = self.cnx.query("""insert into pgresult_test + values (4, 'This is a test (4)')"""); + + def CheckCreatePgResult(self): + query = "create table pgresult_test(f1 int, f2 text)" + res = self.cnx.query(query) + self.CheckForMembers(res) + self.CheckForMethods(res) + expected = [0, 'CREATE', None, 0, 0, None, None, 1, 2 ] + self.CheckMemberValues(res, expected) + # Try to create the table again. This should raise an execption. + self.failUnlessRaises(libpq.OperationalError, self.cnx.query, query) + def CheckPgResult(self): ! res = self.cnx.query("select * from pg_database limit 3") self.CheckForMembers(res) self.CheckForMethods(res) ! expected = [0, 'SELECT', None, 7, 3, None, None, 2, 1 ] ! self.CheckMemberValues(res, expected) ! ! class PgResultTestCases(unittest.TestCase): ! def setUp(self): ! self.cnx = libpq.PQconnectdb('dbname=pypgsql') ! self.vstr = "%(major)d.%(minor)d" % self.cnx.version.__dict__ ! self.cnx.query('begin work') ! ! def tearDown(self): ! try: ! self.cnx.query('rollback') ! self.cnx.finish() ! except AttributeError: ! pass ! except libpq.InterfaceError: ! pass def CheckSelectOfNonPrintableString(self): *************** *** 109,113 **** if __name__ == "__main__": TestSuite = unittest.TestSuite() ! TestSuite.addTest(PgResultTestCases("CheckPgResult")) TestSuite.addTest(PgResultTestCases("CheckSelectOfNonPrintableString")) --- 242,253 ---- if __name__ == "__main__": TestSuite = unittest.TestSuite() ! TestSuite.addTest(PgResultMethodTestCases("CheckPgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckCreatePgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckInsertPgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckSelectPgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckUpdatePgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckDeclarePgResult")) ! #TestSuite.addTest(PgResultMethodTestCases("CheckFetchPgResult")) ! TestSuite.addTest(PgResultMethodTestCases("CheckDropPgResult")) TestSuite.addTest(PgResultTestCases("CheckSelectOfNonPrintableString")) |
From: Billy G. A. <Bil...@mu...> - 2001-09-05 02:23:27
|
Testing ... please ignore. -- ____ | Billy G. Allie | Domain....: Bil...@mu... | /| | 7436 Hartwell | MSN.......: B_G...@em... |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 | |