yield from cur._start_query(query)
pgq = cur._convert_query(query, params)
- cur._execute_send(pgq)
+ cur._execute_send(pgq, no_pqexec=True)
results = yield from execute(conn.pgconn)
cur._execute_results(results)
assert cur.description[1].name == "baz"
+@pytest.mark.parametrize(
+ "stmt", ["", "wat", "create table ssc ()", "select 1; select 2"]
+)
+def test_execute_error(conn, stmt):
+ cur = conn.cursor("foo")
+ with pytest.raises(e.ProgrammingError):
+ cur.execute(stmt)
+
+
def test_executemany(conn):
cur = conn.cursor("foo")
with pytest.raises(e.NotSupportedError):
assert cur.description[1].name == "baz"
+@pytest.mark.parametrize(
+ "stmt", ["", "wat", "create table ssc ()", "select 1; select 2"]
+)
+async def test_execute_error(aconn, stmt):
+ cur = aconn.cursor("foo")
+ with pytest.raises(e.ProgrammingError):
+ await cur.execute(stmt)
+
+
async def test_executemany(aconn):
cur = aconn.cursor("foo")
with pytest.raises(e.NotSupportedError):