Skip to content

Commit

Permalink
Updated pragma shell checking code
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbinns committed Jun 4, 2024
1 parent 5ea545c commit 39ec5e4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tools/docmissing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,27 @@
import apsw.shell

con = apsw.Connection("")
for pragma in con.execute("pragma pragma_list").get:
assert pragma in apsw.shell.Shell._pragmas, f"pragma { pragma } not in apsw.shell.Shell._pragmas"
all_pragmas = set(con.execute("pragma pragma_list").get)
deprecated_pragmas = {
"count_changes",
"empty_result_callbacks",
"full_column_names",
"legacy_file_format",
"short_column_names",
"temp_store_directory",
}
for pragma in all_pragmas:
if pragma in deprecated_pragmas:
continue
check = (pragma, f"{pragma}=", f"{pragma}(", f"{pragma};")
assert any(c in apsw.shell.Shell._pragmas for c in check), f"pragma { pragma } not in apsw.shell.Shell._pragmas"

# check all pragmas are known to sqlite
for pragma in apsw.shell.Shell._pragmas:
for c in "=(;":
if pragma.endswith(c):
pragma = pragma[:-1]
assert pragma in all_pragmas or pragma in deprecated_pragmas, f"{pragma} is in shell but not known to SQLite"


retval = 0
Expand Down

0 comments on commit 39ec5e4

Please sign in to comment.