Received: from bajor.mug.org (bajor.mug.org [207.158.132.10]) by hub.org (8.10.1/8.10.1) with ESMTP id e6KLx8h60385 for ; Thu, 20 Jul 2000 17:59:08 -0400 (EDT) Received: from bajor.mug.org (localhost [127.0.0.1]) by bajor.mug.org (8.8.7/UW7.0.1) with ESMTP id SAA20408; Thu, 20 Jul 2000 18:07:20 -0400 (EDT) Message-Id: <200007202207.SAA20408@bajor.mug.org> X-Mailer: exmh version 2.1.1 10/15/1999 From: "Billy G. Allie" Reply-To: "Billy G. Allie" To: "Nagy Laszlo Zsolt , KLTE TTK pm1" Cc: pgsql-interfaces@postgresql.org Subject: Re: PyGreSQL and transactions In-Reply-To: Your message of "Thu, 20 Jul 2000 12:14:48 +0200." Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==_Exmh_-310827163P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Date: Thu, 20 Jul 2000 18:07:19 -0400 X-Archive-Number: 200007/172 --==_Exmh_-310827163P Content-Type: text/plain; charset=us-ascii "Nagy Laszlo Zsolt , KLTE TTK pm1" wrote: > > Hi all. > > I'm writting a text-based server program with PyGreSQL. > My first problem follows: > > >>> import pg > >>> db = pg.DB('gandalf','localhost',5432,None,None,'gandalf','') > >>> db.query('BEGIN') > >>> db.query("INSERT INTO tbl(s) VALUES('value1')") > NOTICE: current transaction is aborted, queries ignored until end of transaction block > >>> db.query('commit') > >>> > > The notice was sent to stderr, it seems that I have no way to catch it. > There is getnotify(), but there is no getnotice(). I must catch it, > because my server must know if the operation was successful. (It is > in a multi-tier application's middle, and sends back a message about > the operation.) > I have a Python to PostgreSQL interface program that I am preparing to release. It has the following features: 1. Support for cursors using 'DECLARE ... ' systax. 2. Support the following PostgreSQL typs as Python objects: PG_BOOL, PG_INT2, PG_INT4, PG_INT8, PG_FLOAT4 PG_FLOAT8, PG_CHAR, PG_VARCHAR, PG_TEXT, PG_BLOB (Large Objects), PG_NUMERIC The PG_NUMERIC support include *, /, +, and - operators. The PG_BLOB fully emulates a Python File Object except for truncate(). 3. Support for PostgreSQL arrays. They are converted to/from Python lists on input/output. 4. PostgreSQL notices are made available via the notices attribute of a connection object. The notices attribute is implemented as a list of notices such that connection.notices.pop() will return the first notice recieved from the back-end. Coalling pop() will return the next notice received, and so on. 5. Traps attempts to drop tables/indices, and unlinking large objects within a transasction. These actions are dangerous, since they can not be successfully rolled back with the current version of PostgreSQL. If the transactions were aborted or rolled back, the database will be left in a state where accessing the table, index, or large object that was dropped will result in an error because PostgreSQL can not access the file associated with the table/index/LO. I have been using the interface for about a week now without problems., but have only been using it on UnixWare 7.0. If you are interested in using the interface, I can send it to you and provide some assistance in porting it to your environement (if needed). > Second problem: > > >>> lo = db.locreate(pg.INV_WRITE) > >>> lo > Closed large object, oid 18863 > >>> lo.open(pg.INV_WRITE) > Traceback (innermost last): > File "", line 1, in ? > IOError: can't open large object. > >>> Large Objects can only be opened and used in a transaction. -- ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | Compuserve: 76337,2061 |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com |/ |LLIE | (313) 582-1540 | --==_Exmh_-310827163P Content-Type: application/pgp-signature -----BEGIN PGP MESSAGE----- Version: PGPfreeware 5.0i for non-commercial use MessageID: 6jUicLqUMcsrWp7r8+WMySIrQONqeuvK owFtVk1sI0kVHkAgMPiwQmg5PmWR7CztdhJnMtnAZEky3oy1nnhIPLMrQBuV22W7 SHdVU1Xt2CgHrpy4clkJxA0tEiAkxA1x4rQHOHDhiMSZlTjsBfG96nbiaLelxNVd 733v73uv6qcP3vzc5z/zxvXi1V++l33DffSzP77y2Y///eAXf1rY917fe81/8Ov3 d//w9//9+cMPfvK7B+9/lT78529//5e/fmH3+53//us/f/vV13/+j9985cv+a22f 5e2tOHPTeGdrZ6sTy0U2++Ir/R+cGO2l9q3hMpcH5OXCt/NUKP0tSmbCOukfF64l XKJUvVavbZyJ6ZL6wv04NfQ9Z1JPEb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