| 117 | |
| 118 | |
| 119 | def test_execute_binary(conn): |
| 120 | cur = conn.cursor("foo") |
| 121 | cur.execute("select generate_series(1, 2)::int4", binary=True) |
| 122 | assert cur.fetchone() == (1,) |
| 123 | assert cur.pgresult.fformat(0) == 1 |
| 124 | assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x01" |
| 125 | assert cur.fetchone() == (2,) |
| 126 | assert cur.pgresult.fformat(0) == 1 |
| 127 | assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x02" |
| 128 | |
| 129 | cur.execute("select generate_series(1, 1)::int4") |
| 130 | assert cur.fetchone() == (1,) |
| 131 | assert cur.pgresult.fformat(0) == 0 |
| 132 | assert cur.pgresult.get_value(0, 0) == b"1" |
| 133 | cur.close() |
| 134 | |
| 135 | |
| 136 | def test_binary_cursor_text_override(conn): |