From: Gerhard H?r. <gha...@us...> - 2002-10-02 04:52:59
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv26716/pyPgSQL Modified Files: PgSQL.py Log Message: 02OCT2002 gh - Only support mxDateTime 2.x and give useful error message if import fails. - Cosmetic changes: use cmp builtin where appropriate. - Fixed typo where PgTypes.__str__ was spelled incorrectly. Compare to None using "is" operator. - Take into account that libpq.PgInt8Type might not be available. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PgSQL.py 8 Sep 2002 15:16:45 -0000 1.15 --- PgSQL.py 2 Oct 2002 04:52:56 -0000 1.16 *************** *** 30,33 **** --- 30,40 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 02OCT2002 gh - Only support mxDateTime 2.x and give useful error | + # message if import fails. | + # - Cosmetic changes: use cmp builtin where appropriate. | + # - Fixed typo where PgTypes.__str__ was spelled | + # incorrectly. Compare to None using "is" operator. | + # - Take into account that libpq.PgInt8Type might not be | + # available. | # 08SEP2002 gh Fixed various problems with the PgResultSet: | # - Column (attribute and dictionary) access is now case- | *************** *** 353,357 **** from mx import DateTime except ImportError: ! import DateTime from libpq import * --- 360,366 ---- from mx import DateTime except ImportError: ! raise ImportError, \ ! """You need to install mxDateTime ! (http://www.egenix.com/files/python/eGenix-mx-Extensions.html)""" from libpq import * *************** *** 470,484 **** def __cmp__(self, other): ! if self.value < other: ! return -1 ! elif self.value == other: ! return 0 ! else: ! return 1 def __repr__(self): return PQftypeName(self.value) ! def __prt__(self): return PQftypeName(self.value) --- 479,488 ---- def __cmp__(self, other): ! return cmp(self.value, other) def __repr__(self): return PQftypeName(self.value) ! def __str__(self): return PQftypeName(self.value) *************** *** 1246,1250 **** def __cmp__(self, other): ! if other == None: return 1 _c = self.__coerce__(other) --- 1250,1254 ---- def __cmp__(self, other): ! if other is None: return 1 _c = self.__coerce__(other) *************** *** 1342,1351 **** def __cmp__(self, other): ! if self.value < other: ! return -1 ! elif self.value == other: ! return 0 ! else: ! return 1 def __add__(self, other): --- 1346,1350 ---- def __cmp__(self, other): ! return cmp(self.value, other) def __add__(self, other): *************** *** 1476,1485 **** def __cmp__(self, other): ! if self.value < other: ! return -1 ! elif self.value == other: ! return 0 ! else: ! return 1 def __nonzero__(self): --- 1475,1479 ---- def __cmp__(self, other): ! return cmp(self.value, other) def __nonzero__(self): *************** *** 1592,1596 **** def _quote(self, forArray=0): ! if self.value: s = str(self.value) if s[-1:] == "L": --- 1586,1590 ---- def _quote(self, forArray=0): ! if self.value is not None: s = str(self.value) if s[-1:] == "L": *************** *** 1599,1602 **** --- 1593,1598 ---- return 'NULL' + PgInt8Type = PgInt8 + #-----------------------------------------------------------------------+ *************** *** 1801,1805 **** elif type(_i) in [DateTime.DateTimeType, DateTime.DateTimeDeltaType]: _j = '%s"%s",' % (_j, _i) ! elif type(_i) is PgInt2Type or type(_i) is PgInt8Type: _j = '%s%s,' % (_j, str(_i)) else: --- 1797,1801 ---- elif type(_i) in [DateTime.DateTimeType, DateTime.DateTimeDeltaType]: _j = '%s"%s",' % (_j, _i) ! elif type(_i) is PgInt2Type or isinstance(_i, PgInt8Type): _j = '%s%s,' % (_j, str(_i)) else: |