#9842 closed enhancement (fixed)
[PATCH] Make database connectors reusable
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | database backend | Version: | 0.12.1 |
Severity: | normal | Keywords: | patch |
Cc: | Thijs Triemstra | Branch: | |
Release Notes: |
Trac database connectors may now be used independently of Trac |
||
API Changes: |
|
||
Internal Changes: |
Description
I'm currently working on a project that needs a separate database. So I'd like to use Trac's database connectors (or database api in more general). However, they were not implemented for this use case.
I've created a patch that changes the init_db()
method so that the schema isn't hard-coded anymore but is passed as argument to the method. This is the first (and IMHO most pressing) step to allow reusability.
A second step (which isn't covered in my patch) would be to make the class trac.db.db.DatabaseManager
reusable in that the db URI isn't hard-coded anymore but passed as argument somehow.
Note: The patch I've attached to this ticket also contains the patch from #9841. Sorry about this.
Attachments (2)
Change History (17)
by , 14 years ago
Attachment: | reusable_db_connectors.patch added |
---|
comment:1 by , 14 years ago
The patch looks good. Unfortunately, as it is, it breaks a public API, so it can only be considered for 0.13. If you can rework the patch so that it remains backward-compatible, we could consider applying it for 0.12.2.
follow-up: 3 comment:2 by , 14 years ago
Ok - if you could tell me the usecase for the parameter I removed, I'll do this.
comment:3 by , 14 years ago
Replying to Sebastian Krysmanski <sebastian@…>:
Ok - if you could tell me the usecase for the parameter I removed, I'll do this.
I don't follow you, so let me rephrase. Your patch adds a mandatory argument schema
. This breaks all (external) code that doesn't provide the argument. Instead, if you make the schema
argument optional, and import Trac's schema if the argument isn't provided, the function signature remains backward-compatible.
comment:4 by , 14 years ago
Sorry, I filed too many tickets today so I got them confused. I'll change the patch acordingly.
by , 14 years ago
Attachment: | reusable_db_connectors.trac012.patch added |
---|
Patch against Trac 0.12.1 (without breaking a public api)
comment:6 by , 14 years ago
Cc: | added |
---|---|
Keywords: | review added |
Summary: | Make database connectors reusable → [PATCH] Make database connectors reusable |
This patch needs a review.
comment:7 by , 14 years ago
Milestone: | → 0.13 |
---|---|
Owner: | set to |
Priority: | normal → high |
Right, I'll do that.
comment:8 by , 14 years ago
Keywords: | patch added; review removed |
---|
comment:9 by , 14 years ago
Ah… just one question: I did change my patch so that it doesn't break Trac's public API in Trac 0.12. Why then is this patch scheduled for Trac 0.13?
comment:10 by , 14 years ago
The 0.12-stable branch only gets bug fixes. This is an enhancement. See the "note to maintainers" in 0.12.2.
comment:11 by , 14 years ago
Cc: | added; removed |
---|
comment:12 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Slightly cleaned-up patch applied in [10371].
I do realize that I made conflicting statements between comment:1 and comment:10, with the latter being correct. Sorry about that.
comment:13 by , 14 years ago
Owner: | changed from | to
---|
comment:14 by , 13 years ago
comment:15 by , 13 years ago
API Changes: | modified (diff) |
---|
Patch against Trac 0.12.1