diff options
| author | Federico Di Gregorio <fog@initd.org> | 2005-03-23 11:02:13 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2005-03-23 11:02:13 +0000 |
| commit | cb9cec57c0ef4d8a7081efd056bd7d742917ff73 (patch) | |
| tree | 09117ca0fba2fab5804fcdbbef9c3793566a2299 /sandbox/array.py | |
| parent | 19cb161d2783665093f8cddb7dacd7da0c87703d (diff) | |
| download | psycopg2-cb9cec57c0ef4d8a7081efd056bd7d742917ff73.tar.gz | |
Array support for all basic types.
Diffstat (limited to 'sandbox/array.py')
| -rw-r--r-- | sandbox/array.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sandbox/array.py b/sandbox/array.py index af09140..5d37776 100644 --- a/sandbox/array.py +++ b/sandbox/array.py @@ -4,14 +4,18 @@ conn = psycopg.connect("dbname=test") curs = conn.cursor() curs.execute("SELECT ARRAY[1,2,3] AS foo") -print curs.fetchone() +print curs.fetchone()[0] curs.execute("SELECT ARRAY['1','2','3'] AS foo") -print curs.fetchone() +print curs.fetchone()[0] curs.execute("""SELECT ARRAY[',','"','\\\\'] AS foo""") -d = curs.fetchone() -print d, '->', d[0][0], d[0][1], d[0][2] +d = curs.fetchone()[0] +print d, '->', d[0], d[1], d[2] curs.execute("SELECT ARRAY[ARRAY[1,2],ARRAY[3,4]] AS foo") -print curs.fetchone() +print curs.fetchone()[0] + +curs.execute("SELECT ARRAY['20:00:01'::time] AS foo") +print curs.description +print curs.fetchone()[0] |
