From: Billy G. A. <bal...@us...> - 2002-02-01 23:04:16
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv13763/pyPgSQL Modified Files: PgSQL.py Log Message: 01FEB2002 bga - Fixed a couple of problems found by Steven D. Arnold: 1. A undefined variable was used in a few places where notices were popped from the notice list. 2. Comparisons between 2 PgNumerics gave the wrong result. 18JAN2002 bga - Fixed problem that occurs when the sum() aggregate returns a NULL. [Bug #505162]. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgSQL.py 2002/01/12 23:20:14 1.5 --- PgSQL.py 2002/02/01 23:04:13 1.6 *************** *** 30,33 **** --- 30,40 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 01FEB2002 bga Fixed a couple of problems found by Steven D. Arnold: | + # 1. A undefined variable was used in a few places where | + # notices were popped from the notice list. | + # 2. Comparisons between 2 PgNumerics gave the wrong re- | + # sult. | + # 18JAN2002 bga Fixed problem that occurs when the sum() aggregate re- | + # turns a NULL. [Bug #505162]. | # 04DEC2001 bga Added code to implement support for setting PostgreSQL | # transaction levels. [Feature Request #481727]. | *************** *** 872,875 **** --- 879,896 ---- return PgNumeric(self._round(_q, 1), self.__p, self.__s) + def __cmp__(self, other): + if self.__s < other.__s: + _d = other.__s - self.__s + _s = (self.__v * (10L ** _d)) + _o = other.__v + elif self.__s > other.__s: + _d = self.__s - other.__s + _s = self.__v + _o = (other.__v * (10L ** _d)) + else: + _s = self.__v + _o = other.__v + return cmp(_s, _o) + def __add__(self, other): if self.__s < other.__s: *************** *** 1637,1641 **** self.conn.query("ROLLBACK WORK") if len(self.conn.notices) != _nl: ! raise Warning, self.__conn.notices.pop() except: pass --- 1658,1662 ---- self.conn.query("ROLLBACK WORK") if len(self.conn.notices) != _nl: ! raise Warning, self.conn.notices.pop() except: pass *************** *** 1722,1726 **** self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.__conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 --- 1743,1747 ---- self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 *************** *** 1830,1834 **** self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.__conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 --- 1851,1855 ---- self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 *************** *** 1969,1973 **** _p = nv.getPrecision() _s = nv.getScale() ! except ValueError, m: _p = 30 _s = 6 --- 1990,1994 ---- _p = nv.getPrecision() _s = nv.getScale() ! except (ValueError, TypeError), m: _p = 30 _s = 6 *************** *** 2026,2030 **** self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.__conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 --- 2047,2051 ---- self.conn.TransactionLevel) if len(self.conn.notices) != _nl: ! raise Warning, self.conn.notices.pop() self.conn.__dict__["inTransaction"] = 1 *************** *** 2192,2196 **** self.conn.conn.query('ROLLBACK WORK') if len(self.conn.notices) != _n: ! raise Warning, self.__conn.notices.pop() self.conn.__dict__["inTransaction"] = 0 self.conn._Connection__closeCursors() --- 2213,2217 ---- self.conn.conn.query('ROLLBACK WORK') if len(self.conn.notices) != _n: ! raise Warning, self.conn.notices.pop() self.conn.__dict__["inTransaction"] = 0 self.conn._Connection__closeCursors() |