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