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