Ticket #3459: tztest.py

File tztest.py, 657 bytes (added by Jack Moffitt <metajack@…>, 18 years ago)

test script

Line 
1#!/usr/bin/env python
2
3import sys
4import psycopg2
5
6
7for level in (0, 1, 2):
8 connection = psycopg2.connect(sys.argv[1])
9 connection.set_isolation_level(1)
10
11 print 'In isolation level: %d' % (level,)
12
13 c = connection.cursor()
14 c.execute('SHOW TIME ZONE')
15 print 'Original time zone: %s' % (c.fetchone()[0],)
16
17 c = connection.cursor()
18 c.execute('SET TIME ZONE \'EST\'')
19 c.execute('SHOW TIME ZONE')
20 print 'Set timezone to: %s' % (c.fetchone()[0],)
21 connection.commit()
22
23 c = connection.cursor()
24 c.execute('SHOW TIME ZONE')
25 print 'Next cursor got time zone: %s' % (c.fetchone()[0],)
26
27 connection.close()
Back to Top