Re: Multiple result sets - Mailing list pgsql-general

From joe@omc-international.com.au
Subject Re: Multiple result sets
Date
Msg-id 58894.124.168.21.37.1212359044.squirrel@polaris.omc-international.com.au
Whole thread Raw
In response to Re: Multiple result sets  (Clodoaldo <clodoaldo.pinto.neto@gmail.com>)
List pgsql-general
> I'm not sure i got it. You mean like this?:
>
> import psycopg2 as db
> dsn = 'host=localhost dbname=dbname user=user password=passwd'
> connection = db.connect(dsn)
> cursor = connection.cursor()
>
> cursor.execute('BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;');
> rs1 = cursor.execute(query_1, (param1,))
> rs2 = cursor.execute(query_2, (param2,))
> cursor.execute('commit;');
>
> cursor.close()
> connection.close()

You will actually need to do this:

cursor.execute('BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;');
cursor.execute(query_1, (param1,))
rs1 = cursor.fetchall()
cursor.execute(query_2, (param2,))
rs2 = cursor.fetchall()
cursor.execute('commit;');


Hope that helps,

Joe


pgsql-general by date:

Previous
From: "Adam Rich"
Date:
Subject: Re: Multiple result sets
Next
From: Chris
Date:
Subject: Re: phpeclipse debugging & setup