~psycopg/psycopg/2.0.x

« back to all changes in this revision

Viewing changes to sandbox/crash.py

  • Committer: Federico Di Gregorio
  • Date: 2006-03-30 02:20:11 UTC
  • Revision ID: fog-0012b4068eaad7d8b02b4f40e7f1b41e7d75f524
Fixing SVN transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
#import psycopg as db
 
4
import psycopg2 as db
 
5
import threading
 
6
import time
 
7
import sys
 
8
 
 
9
def query_worker(dsn):
 
10
    conn = db.connect(dsn)
 
11
    cursor = conn.cursor()
 
12
    while True:
 
13
        cursor.execute("select * from pg_class")
 
14
        while True:
 
15
            row = cursor.fetchone()
 
16
            if row is None:
 
17
                break
 
18
 
 
19
if len(sys.argv) != 2:
 
20
    print 'usage: %s DSN' % sys.argv[0]
 
21
    sys.exit(1)
 
22
th = threading.Thread(target=query_worker, args=(sys.argv[1],))
 
23
th.setDaemon(True)
 
24
th.start()
 
25
time.sleep(1)