Opened 9 years ago
Closed 9 years ago
#27077 closed Cleanup/optimization (fixed)
Simplify calls to is_in_memory_db() in SQLite's DatabaseCreation
| Reported by: | Chris Jerdonek | Owned by: | Chris Jerdonek |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Currently, the SQLite backend's DatabaseCreation class calls self.connection.is_in_memory_db(database_name) in several spots (in five places to be precise). Here is a link to the class in the source code.
This is a bit confusing because is_in_memory_db() doesn't actually depend on the connection in any way. It's only a function of the database name. (Intuitively, one way to see this is that if you are using a different database name, then you must be using a different connection.)
This ticket is to simplify / clarify this by refactoring out a function that depends only on the database name, as well making the calls inside DatabaseCreation more DRY.
Change History (5)
comment:1 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
Looking at the commit that introduced the method, 8c99b7920e8187f98cf4d7dbd9918bd6c6da1238, I think the database name is usually coming from the connection's
SETTINGS_DICTthough, perhaps with some adjustments by the database backend.