每当游标有数据时我都可以调用 cnxn.commit() 但是当游标为空时它会抛出 cnxn.commit() mariadb.InterfaceError: Commands out of sync; you can't run this command Now 使用 cursor.execute("call getNames")
cnxn.commit()
cnxn.commit() mariadb.InterfaceError: Commands out of sync; you can't run this command Now
解决方案是我不应该调用存储过程,而是像 cursor.execute("SELECT * FROM names")
cursor.execute("SELECT * FROM names")