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