Show More
@@ -56,11 +56,12 b' class HistoryTrim(BaseIPythonApplication):' | |||||
56 |
|
56 | |||
57 | inputs.pop() # Remove the extra element we got to check the length. |
|
57 | inputs.pop() # Remove the extra element we got to check the length. | |
58 | inputs.reverse() |
|
58 | inputs.reverse() | |
59 | first_session = inputs[0][0] |
|
59 | if inputs: | |
60 | outputs = list(con.execute('SELECT session, line, output FROM ' |
|
60 | first_session = inputs[0][0] | |
61 | 'output_history WHERE session >= ?', (first_session,))) |
|
61 | outputs = list(con.execute('SELECT session, line, output FROM ' | |
62 | sessions = list(con.execute('SELECT session, start, end, num_cmds, remark FROM ' |
|
62 | 'output_history WHERE session >= ?', (first_session,))) | |
63 | 'sessions WHERE session >= ?', (first_session,))) |
|
63 | sessions = list(con.execute('SELECT session, start, end, num_cmds, remark FROM ' | |
|
64 | 'sessions WHERE session >= ?', (first_session,))) | |||
64 | con.close() |
|
65 | con.close() | |
65 |
|
66 | |||
66 | # Create the new history database. |
|
67 | # Create the new history database. | |
@@ -83,11 +84,12 b' class HistoryTrim(BaseIPythonApplication):' | |||||
83 | new_db.commit() |
|
84 | new_db.commit() | |
84 |
|
85 | |||
85 |
|
86 | |||
86 | with new_db: |
|
87 | if inputs: | |
87 | # Add the recent history into the new database. |
|
88 | with new_db: | |
88 | new_db.executemany('insert into sessions values (?,?,?,?,?)', sessions) |
|
89 | # Add the recent history into the new database. | |
89 |
new_db.executemany('insert into |
|
90 | new_db.executemany('insert into sessions values (?,?,?,?,?)', sessions) | |
90 |
new_db.executemany('insert into |
|
91 | new_db.executemany('insert into history values (?,?,?,?)', inputs) | |
|
92 | new_db.executemany('insert into output_history values (?,?,?)', outputs) | |||
91 | new_db.close() |
|
93 | new_db.close() | |
92 |
|
94 | |||
93 | if self.backup: |
|
95 | if self.backup: |
General Comments 0
You need to be logged in to leave comments.
Login now