diff options
Diffstat (limited to 'sandbox/test.py')
-rw-r--r-- | sandbox/test.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/sandbox/test.py b/sandbox/test.py index 5704f73..def672e 100644 --- a/sandbox/test.py +++ b/sandbox/test.py @@ -1,12 +1,30 @@ import datetime +import time import psycopg #d = datetime.timedelta(12, 100, 9876) #print d.days, d.seconds, d.microseconds #print psycopg.adapt(d).getquoted() -o = psycopg.connect("dbname=test") -c = o.cursor() -c.execute("SELECT 1.0 AS foo") -print c.fetchmany(2) -print c.fetchall() +conn = psycopg.connect("dbname=test") +curs = conn.cursor() +#curs.execute("SELECT 1.0 AS foo") +#print curs.fetchmany(2) +#print curs.fetchall() + +def sleep(curs): + while not curs.isready(): + print "." + time.sleep(.1) + +#curs.execute(""" +# DECLARE zz INSENSITIVE SCROLL CURSOR WITH HOLD FOR +# SELECT now(); +# FOR READ ONLY;""", async = 1) +curs.execute("SELECT now() AS foo", async=1); +sleep(curs) + +#curs.execute(""" +# FETCH FORWARD 1 FROM zz;""", async = 1) +curs.execute("SELECT now() AS bar", async=1); +sleep(curs) |