comparison roundup/backends/back_sqlite.py @ 6930:a96a239db0d9

Set all sqlite db's to WAL mode on creation Complete work done on 6917:fba76e0bba98. WAL journaling mode now enabled on primary db as well as session db's when using sqlite for session databases. Made change to WAL mode more robust for testing by bracketing `pragma journal_mode=wal` with commit() calls. Normally the conversion would occur when a new session was opened, but this commits the changes explicitly to make all the tests stable. Also added doc on this.
author John Rouillard <rouilj@ieee.org>
date Thu, 08 Sep 2022 01:12:12 -0400
parents fba76e0bba98
children ff7f6c0bbdae
comparison
equal deleted inserted replaced
6929:581b09777eba 6930:a96a239db0d9
202 self.sql('create table ids (name varchar, num integer)') 202 self.sql('create table ids (name varchar, num integer)')
203 self.sql('create index ids_name_idx on ids(name)') 203 self.sql('create index ids_name_idx on ids(name)')
204 self.create_version_2_tables() 204 self.create_version_2_tables()
205 self._add_fts5_table() 205 self._add_fts5_table()
206 # Set journal mode to WAL. 206 # Set journal mode to WAL.
207 self.conn.execute('pragma journal_mode=wal') 207 self.sql_commit() # close out rollback journal/transaction
208 self.sql('pragma journal_mode=wal') # set wal
209 self.sql_commit() # close out rollback and commit wal change
208 210
209 def create_version_2_tables(self): 211 def create_version_2_tables(self):
210 self.sql('create table otks (otk_key varchar, ' 212 self.sql('create table otks (otk_key varchar, '
211 'otk_value varchar, otk_time integer)') 213 'otk_value varchar, otk_time integer)')
212 self.sql('create index otks_key_idx on otks(otk_key)') 214 self.sql('create index otks_key_idx on otks(otk_key)')

Roundup Issue Tracker: http://roundup-tracker.org/