From: Billy G. A. <bal...@us...> - 2001-09-24 16:53:36
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv7863 Modified Files: PgSQL.py Log Message: 24SEP2001 bga Completed BYTEA type implementation. --- Changed code to reflect new _quote function in PgLargeObject. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/PgSQL.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PgSQL.py 2001/09/24 07:10:56 1.22 --- PgSQL.py 2001/09/24 16:53:33 1.23 *************** *** 34,37 **** --- 34,38 ---- # removed from pgconnection.c. | # --- Added support for the PostgreSQL type BYTEA. | + # --- Improved support for the BYTEA type. | # 19SEP2001 bga Cleaned up the logic in hadleArray(). | # --- Updated the PgSQL.__doc__ string. | *************** *** 490,494 **** return DateTime.ISO.ParseAny(value) elif _ftv == PG_BYTEA: ! return PgBytea(value) elif _ftv == OTHER: if isinstance(value, PgOther): --- 491,498 ---- return DateTime.ISO.ParseAny(value) elif _ftv == PG_BYTEA: ! if isinstance(value, PgBytea): ! return value ! else: ! return PgBytea(value) elif _ftv == OTHER: if isinstance(value, PgOther): *************** *** 532,536 **** lst[_i] = PgMoney(float(replace(lst[_i][1:], ',', ''))) elif _ftv == BINARY: ! lst[_i] = self.conn.conn.lo_get(lst[_i]) return lst --- 536,543 ---- lst[_i] = PgMoney(float(replace(lst[_i][1:], ',', ''))) elif _ftv == BINARY: ! if _ftv == PG_BYTEA: ! lst[_i] = PgBytea(PgUnQuoteBytea(lst[_i])) ! else: ! lst[_i] = self.conn.conn.lo_get(lst[_i]) return lst *************** *** 1381,1390 **** elif type(_i) == PgInt2Type or \ type(_i) == PgLargeObjectType: ! _j = '%s%s,' % (_j, str(_i)) elif (type(PgInt8) == ClassType and isinstance(_i, PgInt8)) or \ type(_i) == PgInt8Type: _j = '%s%s,' % (_j, str(_i)) else: ! _s = repr(_i) if _s[0] == "'": _j = '%s"%s",' % (_j, replace(_s, '"', '\\"')[1:-1]) --- 1388,1400 ---- elif type(_i) == PgInt2Type or \ type(_i) == PgLargeObjectType: ! _j = '%s%s,' % (_j, _i._quote) elif (type(PgInt8) == ClassType and isinstance(_i, PgInt8)) or \ type(_i) == PgInt8Type: _j = '%s%s,' % (_j, str(_i)) else: ! if isinstance(PgBytea) or isinstance(PgOther): ! _s = value._quote() ! else: ! _s = PgQuoteString(_i) if _s[0] == "'": _j = '%s"%s",' % (_j, replace(_s, '"', '\\"')[1:-1]) *************** *** 1408,1412 **** if type(value) in [ListType, TupleType]: ! return repr(_handleArray(list(value))) if hasattr(value, '_quote'): --- 1418,1422 ---- if type(value) in [ListType, TupleType]: ! return PgQuoteString(_handleArray(list(value))) if hasattr(value, '_quote'): *************** *** 1418,1424 **** if type(value) in [DateTimeType, DateTimeDeltaType]: return "'%s'" % value - - if type(value) == PgLargeObjectType: - return str(value) return repr(value) --- 1428,1431 ---- |