From: Billy G. A. <bal...@us...> - 2001-09-26 05:42:56
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv28584 Modified Files: PgSQL.py Log Message: 26SEP2001 bga Added additional PostgreSQL types to BINARY, ROWID, etc. --- Fixed problems associated with type casting. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/PgSQL.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PgSQL.py 2001/09/25 20:40:32 1.24 --- PgSQL.py 2001/09/26 05:42:53 1.25 *************** *** 30,38 **** # Date Ini Description | # --------- --- ------------------------------------------------------- | ! # 25SEP2001 bga Changed the code so that a notice in the notice list | ! # will not automatically generate an exception. The ma- | ! # jority of these notices are information and should not | ! # cause an exception to be raised. Only in certain situ- | ! # ation will a notice generate an exception. | # 24SEP2001 bga Changed the method used to quote strings. This new way | # does not require the services of pgFixEsc, which was | --- 30,35 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | ! # 26SEP2001 bga Added additional PostgreSQL types to BINARY, ROWID, etc | ! # --- Fixed problems associated with type casting. | # 24SEP2001 bga Changed the method used to quote strings. This new way | # does not require the services of pgFixEsc, which was | *************** *** 355,366 **** DATETIME = DBAPITypeObject('DATETIME', PG_DATE, PG_TIME, PG_TIMESTAMP, ! PG_ABSTIME, PG_RELTIME, PG_INTERVAL, PG_TINTERVAL) NUMBER = DBAPITypeObject('NUMBER', PG_INT8, PG_INT2, PG_INT4, PG_FLOAT4, ! PG_FLOAT8, PG_MONEY, PG_NUMERIC) ! ROWID = DBAPITypeObject('ROWID', PG_OID, PG_ROWID) ! STRING = DBAPITypeObject('STRING', PG_CHAR, PG_BPCHAR, PG_TEXT, PG_VARCHAR) # BOOLEAN is the PostgreSQL boolean type. --- 352,365 ---- DATETIME = DBAPITypeObject('DATETIME', PG_DATE, PG_TIME, PG_TIMESTAMP, ! PG_ABSTIME, PG_RELTIME, PG_INTERVAL, ! PG_TINTERVAL) NUMBER = DBAPITypeObject('NUMBER', PG_INT8, PG_INT2, PG_INT4, PG_FLOAT4, ! PG_FLOAT8, PG_MONEY, PG_NUMERIC) ! ROWID = DBAPITypeObject('ROWID', PG_OID, PG_ROWID, PG_CID, PG_TID, PG_XID) ! STRING = DBAPITypeObject('STRING', PG_CHAR, PG_BPCHAR, PG_TEXT, PG_VARCHAR, ! PG_NAME) # BOOLEAN is the PostgreSQL boolean type. *************** *** 371,375 **** OTHER = DBAPITypeObject('OTHER', PG_POINT, PG_LSEG, PG_PATH, PG_BOX, ! PG_POLYGON, PG_LINE, PG_CIDR, PG_CIRCLE, PG_INET) #-----------------------------------------------------------------------+ --- 370,375 ---- OTHER = DBAPITypeObject('OTHER', PG_POINT, PG_LSEG, PG_PATH, PG_BOX, ! PG_POLYGON, PG_LINE, PG_CIDR, PG_CIRCLE, ! PG_INET) #-----------------------------------------------------------------------+ *************** *** 467,471 **** else: return PgInt2(value) ! elif _ftv == PG_INT4: if type(value) == IntType: return value --- 467,471 ---- else: return PgInt2(value) ! elif _ftv == PG_INT4 or _ftv == ROWID: if type(value) == IntType: return value *************** *** 523,527 **** if type(lst[_i]) == ListType: lst[_i] = self.handleArray(colinfo, lst[_i]) ! elif _ftv == PG_INT4: lst[_i] = int(lst[_i]) elif _ftv == PG_INT8: --- 523,527 ---- if type(lst[_i]) == ListType: lst[_i] = self.handleArray(colinfo, lst[_i]) ! elif _ftv == PG_INT4 or _ftv == ROWID: lst[_i] = int(lst[_i]) elif _ftv == PG_INT8: *************** *** 544,548 **** lst[_i] = PgBytea(PgUnQuoteBytea(lst[_i])) else: ! lst[_i] = self.conn.conn.lo_get(lst[_i]) return lst --- 544,548 ---- lst[_i] = PgBytea(PgUnQuoteBytea(lst[_i])) else: ! lst[_i] = PgLargeObject(self.conn, int(lst[_i])) return lst *************** *** 1403,1410 **** else: _s = PgQuoteString(_i) ! if _s[0] == "'": ! _j = '%s"%s",' % (_j, replace(_s, '"', '\\"')[1:-1]) ! else: ! _j = '%s%s,' % (_j, _s) return _j[:-1] + '}' --- 1403,1408 ---- else: _s = PgQuoteString(_i) ! # Note: _s will always be single-quoted. ! _j = '%s"%s",' % (_j, _s[1:-1]) return _j[:-1] + '}' |