##// END OF EJS Templates
allow trimming to an empty database (--keep=0)
Paul Ivanov -
Show More
@@ -56,6 +56,7 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 if inputs:
59 first_session = inputs[0][0]
60 first_session = inputs[0][0]
60 outputs = list(con.execute('SELECT session, line, output FROM '
61 outputs = list(con.execute('SELECT session, line, output FROM '
61 'output_history WHERE session >= ?', (first_session,)))
62 'output_history WHERE session >= ?', (first_session,)))
@@ -83,6 +84,7 b' class HistoryTrim(BaseIPythonApplication):'
83 new_db.commit()
84 new_db.commit()
84
85
85
86
87 if inputs:
86 with new_db:
88 with new_db:
87 # Add the recent history into the new database.
89 # Add the recent history into the new database.
88 new_db.executemany('insert into sessions values (?,?,?,?,?)', sessions)
90 new_db.executemany('insert into sessions values (?,?,?,?,?)', sessions)
General Comments 0
You need to be logged in to leave comments. Login now