This patch adds a "vacuum()" function to our sqlite Connection that is
called if we detect that rows have been deleted during `xfstestsdb gc`
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
Right now it doesn't do any extra changes to the database besides
bumping the user_version to '2'. I'll fill it out over the next several
commits.
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This function builds on the built-in Python function, and adds in
opening and reading the file in a way that can be used for running
generic scripts on the database.
I also take this chance to move SQL scripts into a subdirectory to keep
them together.
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
The connection manager is used to initialize the database and has a
wrapper around the sqlite3.execute() and sqlite3.executemany() functions
for easier argument passing.
Additionally, it implements __enter__() and __exit__() functions to
manually begin a transaction to calls can use the sqlite3 "RETURNING"
clause.
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>