summaryrefslogtreecommitdiff
path: root/sandbox/test.py
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2004-11-20 10:57:54 +0000
committerFederico Di Gregorio <fog@initd.org>2004-11-20 10:57:54 +0000
commit61b4ff6e6fb027f2071615eaeb83d44eeea1548d (patch)
treefef10388937c1cfcbda6636ac2ac577b3a015422 /sandbox/test.py
parentb19922ebf3ce966acee6969dbf929b65d2a3d681 (diff)
downloadpsycopg2-61b4ff6e6fb027f2071615eaeb83d44eeea1548d.tar.gz
First fixed to the async core.
Diffstat (limited to 'sandbox/test.py')
-rw-r--r--sandbox/test.py28
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)