mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +03:00
36 lines
792 B
Python
36 lines
792 B
Python
import datetime
|
|
import time
|
|
import psycopg
|
|
|
|
#d = datetime.timedelta(12, 100, 9876)
|
|
#print d.days, d.seconds, d.microseconds
|
|
#print psycopg.adapt(d).getquoted()
|
|
|
|
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)
|
|
print curs.fetchall()
|
|
|
|
#curs.execute("""
|
|
# FETCH FORWARD 1 FROM zz;""", async = 1)
|
|
curs.execute("SELECT now() AS bar", async=1);
|
|
print curs.fetchall()
|
|
|
|
curs.execute("SELECT now() AS bar");
|
|
sleep(curs)
|
|
|