From: Billy G. A. <bal...@us...> - 2001-09-20 03:51:16
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv11090 Modified Files: PgSQL.py Log Message: 19SEP2001 bga Cleaned up the logic in hadleArray(). --- Updated the PgSQL.__doc__ string. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/PgSQL.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PgSQL.py 2001/09/19 03:44:26 1.20 --- PgSQL.py 2001/09/20 03:51:00 1.21 *************** *** 30,33 **** --- 30,35 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 19SEP2001 bga Cleaned up the logic in hadleArray(). | + # --- Updated the PgSQL.__doc__ string. | # 18SEP2001 bga [Feature Request #462588] Cursor.close() no longer ends | # (rollback) the open transaction when the last cursor is | *************** *** 110,121 **** Commit any pending transactions for this connection. ! NOTE: This will close any open cursors for this connection. connection.rollback() Rollback any pending transactions for this connection. ! NOTE: This will close any open cursors for this connection. ! connection.binary(string) -> blob Create a new PostgreSQL large object. If string is present, it is written to the new large object. The returned large object will --- 112,127 ---- Commit any pending transactions for this connection. ! NOTE: This will reset any open cursors for this connection to their ! inital state. Any PostgreSQL portals in use by cursors will ! be closed and any remaining query results will be discarded. connection.rollback() Rollback any pending transactions for this connection. ! NOTE: This will reset any open cursors for this connection to their ! inital state. Any PostgreSQL portals in use by cursors will ! be closed and any remaining query results will be discarded. ! connection.binary(string) -> PgLargeObject Create a new PostgreSQL large object. If string is present, it is written to the new large object. The returned large object will *************** *** 141,163 **** cursor.execute(query[, param1[, param2, ..., paramN]) Execute a query, binding the parameters if they are passed. The ! binding syntax is the same as the '%' operator except that only ! %s [or %(name)s] should be used and the %s [or %(name)s] should ! not be quoted. Any necessary quoting will be performed by the ! execute method. ! cursor.execute(query[, tuple]) ! Execute a query, binding the contents of the tuple as parameters. ! The binding syntax is the same as the '%' operator except that ! only %s should be used and the %s should not be quoted. Any ! necessary quoting will be performed by the execute method. cursor.execute(query[, dictionary]) Execute a query, binding the contents of the dictionary as para- ! meters. The binding syntax is the same as the '%' operator ex- ! cept that only %s [or %(name)s] should be used and the %s [or ! %(name)s] should not be quoted. Any necessary quoting will be ! performed by the execute method. ! NOTE: In order to use a PostgreSQL cursor (i.e. DECLARE ... CURSOR FOR ...), the word SELECT must be the first word in the query, and can only be be proceeded by spaces and tabs. If this is not --- 147,169 ---- cursor.execute(query[, param1[, param2, ..., paramN]) Execute a query, binding the parameters if they are passed. The ! binding syntax is the same as the '%' operator except that only %s ! [or %(name)s] should be used and the %s [or %(name)s] should not be ! quoted. Any necessary quoting will be performed by the execute ! method. ! cursor.execute(query[, sequence]) ! Execute a query, binding the contents of the sequence as parameters. ! The binding syntax is the same as the '%' operator except that only ! %s should be used and the %s should not be quoted. Any necessary ! quoting will be performed by the execute method. cursor.execute(query[, dictionary]) Execute a query, binding the contents of the dictionary as para- ! meters. The binding syntax is the same as the '%' operator except ! that only %s [or %(name)s] should be used and the %s [or %(name)s] ! should not be quoted. Any necessary quoting will be performed by ! the execute method. ! NOTE: In order to use a PostgreSQL portal (i.e. DECLARE ... CURSOR FOR ...), the word SELECT must be the first word in the query, and can only be be proceeded by spaces and tabs. If this is not *************** *** 499,537 **** _ftv = _ft.value ! if _ftv == PG_INT4: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = int(lst[_i]) ! elif _ftv == PG_INT8: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = PgInt8(lst[_i]) ! elif _ftv == PG_NUMERIC: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = PgNumeric(lst[_i], _p, _s) ! elif _ftv == PG_INT2: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = PgInt2(lst[_i]) ! elif _ftv == DATETIME: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = DateTime.ISO.ParseAny(lst[_i]) ! elif _ftv == PG_MONEY: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! elif lst[_i][0] == '(': lst[_i] = PgMoney(-float(replace(lst[_i][2:-1], ',', ''))) elif lst[_i][0] == '-': --- 505,523 ---- _ftv = _ft.value ! for _i in range(len(lst)): ! 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: ! lst[_i] = PgInt8(lst[_i]) ! elif _ftv == PG_NUMERIC: ! lst[_i] = PgNumeric(lst[_i], _p, _s) ! elif _ftv == PG_INT2: ! lst[_i] = PgInt2(lst[_i]) ! elif _ftv == DATETIME: ! lst[_i] = DateTime.ISO.ParseAny(lst[_i]) ! elif _ftv == PG_MONEY: ! if lst[_i][0] == '(': lst[_i] = PgMoney(-float(replace(lst[_i][2:-1], ',', ''))) elif lst[_i][0] == '-': *************** *** 539,548 **** else: lst[_i] = PgMoney(float(replace(lst[_i][1:], ',', ''))) ! elif _ftv == BINARY: ! for _i in range(len(lst)): ! if type(lst[_i]) == ListType: ! lst[_i] = self.handleArray(colinfo, lst[_i]) ! else: ! lst[_i] = self.conn.conn.lo_get(lst[_i]) return lst --- 525,530 ---- else: lst[_i] = PgMoney(float(replace(lst[_i][1:], ',', ''))) ! elif _ftv == BINARY: ! lst[_i] = self.conn.conn.lo_get(lst[_i]) return lst |