A class to manage database connections using a context manager.
More...
|
| | __enter__ (self) |
| | Establishes a connection to the SQLite database.
|
| |
| | __exit__ (self, exc_type, exc_val, exc_tb) |
| | Closes the database connection when exiting the context.
|
| |
A class to manage database connections using a context manager.
Provides a convenient way to handle SQLite connections, ensuring the connection is properly closed after use.
◆ __enter__()
| src.database.DatabaseConnection.__enter__ |
( |
|
self | ) |
|
Establishes a connection to the SQLite database.
- Returns
- sqlite3.Connection object representing the database connection.
◆ __exit__()
| src.database.DatabaseConnection.__exit__ |
( |
|
self, |
|
|
|
exc_type, |
|
|
|
exc_val, |
|
|
|
exc_tb |
|
) |
| |
Closes the database connection when exiting the context.
- Parameters
-
| exc_val | The value of the exception (if any). |
| exc_type | The type of the exception (if any). |
| exc_tb | The traceback of the exception (if any). |
◆ conn
| src.database.DatabaseConnection.conn |
The documentation for this class was generated from the following file: