Update of /cvsroot/pypgsql/pypgsql/pyPgSQL
In directory sc8-pr-cvs1:/tmp/cvs-serv10990
Modified Files:
PgSQL.py
Log Message:
07MAR2003 bga - Correct problem in the PgNumeric.__radd__ method. [Bug #694358]
- Correct problem with conversion of negitive integers (with a
given scale and precision) to PgNumerics. [Bug #694358]
- Work around a problem where the precision and scale of a query
result can be different from the first result in the result set.
[Bug #697221]
Index: PgSQL.py
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** PgSQL.py 12 Jan 2003 10:03:04 -0000 1.31
--- PgSQL.py 7 Mar 2003 06:24:39 -0000 1.32
***************
*** 30,33 ****
--- 30,42 ----
# Date Ini Description |
# --------- --- ------------------------------------------------------- |
+ # 07MAR2003 bga - Correct problem with the PgNumeric.__radd__ method. |
+ # [Bug #694358] |
+ # - Correct problem with conversion of negitive integers |
+ # (with a given scale and precision) to PgNumerics. |
+ # [Bug #694358] |
+ # - Work around a problem where the precision and scale |
+ # of a query result can be different from the first re- |
+ # sult in the result set. |
+ # [Bug #697221] |
# 12JAN2003 bga - Change the code so that the display length in the |
# cursor.description attribute is always None instead |
***************
*** 747,751 ****
return value
else:
! return PgNumeric(value, _p, _s)
elif _ftv == PG_MONEY:
if isinstance(value, PgMoney):
--- 756,768 ----
return value
else:
! try:
! return PgNumeric(value, _p, _s)
! except OverflowError:
! # If we reached this point, then the precision and scale
! # of the current field does not match the precision and
! # scale of the first record in the result set (there are
! # a few reasons that this can happen). Let PgNumeric
! # figure out a precision and scale from the value.
! return PgNumeric(value)
elif _ftv == PG_MONEY:
if isinstance(value, PgMoney):
***************
*** 1256,1260 ****
# Check to see if the value is too large for the given
# precision/scale
! _v = str(value)
if _v[-1:] == 'L':
_v = _v[:-1]
--- 1273,1277 ----
# Check to see if the value is too large for the given
# precision/scale
! _v = str(abs(value))
if _v[-1:] == 'L':
_v = _v[:-1]
***************
*** 1270,1274 ****
# First get the value as a (trimmed) string
if type(value) is FloatType:
! _v = repr(value)
else:
_v = value.split()
--- 1287,1291 ----
# First get the value as a (trimmed) string
if type(value) is FloatType:
! _v = str(value)
else:
_v = value.split()
***************
*** 1493,1497 ****
def __radd__(self, other):
! return __add__(self, other)
def __iadd__(self, other):
--- 1510,1514 ----
def __radd__(self, other):
! return self.__add__(other)
def __iadd__(self, other):
***************
*** 1525,1529 ****
def __rsub__(self, other):
! return self.__sub__(other, self)
def __isub__(self, other):
--- 1542,1546 ----
def __rsub__(self, other):
! return other.__sub__(self)
def __isub__(self, other):
***************
*** 1569,1573 ****
def __rdiv__(self, other):
! return self.__div__(other, self)
def __idiv__(self, other):
--- 1586,1590 ----
def __rdiv__(self, other):
! return other.__div__(self)
def __idiv__(self, other):
|