Update of /cvsroot/pypgsql/pypgsql/pyPgSQL
In directory sc8-pr-cvs1:/tmp/cvs-serv8377/pyPgSQL
Modified Files:
PgSQL.py
Log Message:
01DEC2002 gh - Handle the new '__quote__' method for arrays, too.
- Still handle '_quote' methods for backwards compati-
bility. This will will avoid complaints by users
who have code depending on this. Like me.
Index: PgSQL.py
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** PgSQL.py 1 Dec 2002 04:59:25 -0000 1.23
--- PgSQL.py 1 Dec 2002 21:45:10 -0000 1.24
***************
*** 30,33 ****
--- 30,37 ----
# Date Ini Description |
# --------- --- ------------------------------------------------------- |
+ # 01DEC2002 gh - Handle the new '__quote__' method for arrays, too. |
+ # - Still handle '_quote' methods for backwards compati- |
+ # bility. This will will avoid complaints by users |
+ # who have code depending on this. Like me. |
# 28NOV2002 bga - Fixed changed PG_TIMESTAMP oid, added PG_TIMESTAMPTZ |
# and PG_REFCURSOR oids. [Bug #845360] |
***************
*** 2069,2072 ****
--- 2073,2078 ----
elif isinstance(_i, PgArray):
_j = _j + _handleArray(_i)[1:-1] + ','
+ elif hasattr(_i, '__quote__'):
+ _j = '%s%s,' % (_j, _i.__quote__(1))
elif hasattr(_i, '_quote'):
_j = '%s%s,' % (_j, _i._quote(1))
***************
*** 2092,2109 ****
if value is None:
return 'NULL'
!
! if hasattr(value, '__quote__'):
return value.__quote__()
!
! if type(value) in [DateTimeType, DateTimeDeltaType]:
return "'%s'" % value
!
! if type(value) is StringType:
return PgQuoteString(value)
!
! if type(value) is LongType:
return str(value)
!
! return repr(value)
def _quoteall(vdict):
--- 2098,2113 ----
if value is None:
return 'NULL'
! elif hasattr(value, '__quote__'):
return value.__quote__()
! elif hasattr(value, '_quote'):
! return value._quote()
! elif type(value) in [DateTimeType, DateTimeDeltaType]:
return "'%s'" % value
! elif type(value) is StringType:
return PgQuoteString(value)
! elif type(value) is LongType:
return str(value)
! else:
! return repr(value)
def _quoteall(vdict):
|