Commit Graph

3 Commits

Author SHA1 Message Date
2082b904a0 sqlite: Add an upgrade script to database version 2
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>
2023-07-25 10:03:32 -04:00
3f61adc941 sqlite: Give the Connection an executescript() function
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>
2023-07-25 09:54:31 -04:00
929c1dd5eb xfstestsdb: Create a custom sqlite3 Connection manager
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>
2023-02-15 11:52:41 -05:00