| 1 |
#!/usr/bin/env python |
|---|
| 2 |
|
|---|
| 3 |
import sys |
|---|
| 4 |
import psycopg2 |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
for 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() |
|---|