sqlite3: Reliably detect data query vs modification SQL statements.

pull/118/head^2
Paul Sokolovsky 2014-06-17 00:50:08 +03:00
rodzic 98bb48b3e1
commit b2aa759384
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -89,8 +89,10 @@ class Cursor:
self.num_cols = sqlite3_column_count(self.stmnt)
print("num_cols", self.num_cols)
# If it's not select, actually execute it here
if not sql.startswith("SELECT"):
self.fetchone()
# num_cols == 0 for statements which don't return data (=> modify it)
if not self.num_cols:
v = self.fetchone()
assert v is None
def close(self):
s = sqlite3_finalize(self.stmnt)