Show More
@@ -242,18 +242,24 b' class HistoryAccessor(HistoryAccessorBase):' | |||
|
242 | 242 | kwargs = dict(detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) |
|
243 | 243 | kwargs.update(self.connection_options) |
|
244 | 244 | self.db = sqlite3.connect(str(self.hist_file), **kwargs) |
|
245 | self.db.execute("""CREATE TABLE IF NOT EXISTS sessions (session integer | |
|
246 | primary key autoincrement, start timestamp, | |
|
247 | end timestamp, num_cmds integer, remark text)""") | |
|
248 | self.db.execute("""CREATE TABLE IF NOT EXISTS history | |
|
249 | (session integer, line integer, source text, source_raw text, | |
|
250 | PRIMARY KEY (session, line))""") | |
|
251 | # Output history is optional, but ensure the table's there so it can be | |
|
252 | # enabled later. | |
|
253 | self.db.execute("""CREATE TABLE IF NOT EXISTS output_history | |
|
254 |
|
|
|
255 | PRIMARY KEY (session, line))""") | |
|
256 | self.db.commit() | |
|
245 | with self.db: | |
|
246 | self.db.execute( | |
|
247 | """CREATE TABLE IF NOT EXISTS sessions (session integer | |
|
248 | primary key autoincrement, start timestamp, | |
|
249 | end timestamp, num_cmds integer, remark text)""" | |
|
250 | ) | |
|
251 | self.db.execute( | |
|
252 | """CREATE TABLE IF NOT EXISTS history | |
|
253 | (session integer, line integer, source text, source_raw text, | |
|
254 | PRIMARY KEY (session, line))""" | |
|
255 | ) | |
|
256 | # Output history is optional, but ensure the table's there so it can be | |
|
257 | # enabled later. | |
|
258 | self.db.execute( | |
|
259 | """CREATE TABLE IF NOT EXISTS output_history | |
|
260 | (session integer, line integer, output text, | |
|
261 | PRIMARY KEY (session, line))""" | |
|
262 | ) | |
|
257 | 263 | # success! reset corrupt db count |
|
258 | 264 | self._corrupt_db_counter = 0 |
|
259 | 265 |
General Comments 0
You need to be logged in to leave comments.
Login now