Close the database session, filling in the end time and line count.
(self)
| 770 | self.session_number = cur.lastrowid |
| 771 | |
| 772 | def end_session(self) -> None: |
| 773 | """Close the database session, filling in the end time and line count.""" |
| 774 | self.writeout_cache() |
| 775 | with self.db: |
| 776 | self.db.execute( |
| 777 | """UPDATE sessions SET end=?, num_cmds=? WHERE |
| 778 | session==?""", |
| 779 | ( |
| 780 | datetime.datetime.now(datetime.timezone.utc).isoformat(" "), |
| 781 | len(self.input_hist_parsed) - 1, |
| 782 | self.session_number, |
| 783 | ), |
| 784 | ) |
| 785 | self.session_number = 0 |
| 786 | |
| 787 | def name_session(self, name: str) -> None: |
| 788 | """Give the current session a name in the history database.""" |