Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#9842 closed enhancement (fixed)

[PATCH] Make database connectors reusable

Reported by: Sebastian Krysmanski <sebastian@…> Owned by: Sebastian Krysmanski <sebastian@…>
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:

IDatabaseConnector.init_db() now accepts an optional schema string, if not provided it is read from the TracIni.

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)

reusable_db_connectors.patch (3.4 KB ) - added by Sebastian Krysmanski <sebastian@…> 13 years ago.
Patch against Trac 0.12.1
reusable_db_connectors.trac012.patch (4.1 KB ) - added by Sebastian Krysmanski <sebastian@…> 13 years ago.
Patch against Trac 0.12.1 (without breaking a public api)

Download all attachments as: .zip

Change History (17)

by Sebastian Krysmanski <sebastian@…>, 13 years ago

Patch against Trac 0.12.1

comment:1 by Remy Blank, 13 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.

comment:2 by Sebastian Krysmanski <sebastian@…>, 13 years ago

Ok - if you could tell me the usecase for the parameter I removed, I'll do this.

in reply to:  2 comment:3 by Remy Blank, 13 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 Sebastian Krysmanski <sebastian@…>, 13 years ago

Sorry, I filed too many tickets today so I got them confused. I'll change the patch acordingly.

by Sebastian Krysmanski <sebastian@…>, 13 years ago

Patch against Trac 0.12.1 (without breaking a public api)

comment:5 by Sebastian Krysmanski <sebastian@…>, 13 years ago

I've added a patch like you suggested.

comment:6 by Thijs Triemstra <lists@…>, 13 years ago

Cc: lists@… added
Keywords: review added
Summary: Make database connectors reusable[PATCH] Make database connectors reusable

This patch needs a review.

comment:7 by Remy Blank, 13 years ago

Milestone: 0.13
Owner: set to Remy Blank
Priority: normalhigh

Right, I'll do that.

comment:8 by Thijs Triemstra <lists@…>, 13 years ago

Keywords: patch added; review removed

comment:9 by Sebastian Krysmanski <sebastian@…>, 13 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 Remy Blank, 13 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 Thijs Triemstra, 13 years ago

Cc: Thijs Triemstra added; lists@… removed

comment:12 by Remy Blank, 13 years ago

Resolution: fixed
Status: newclosed

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 Remy Blank, 13 years ago

Owner: changed from Remy Blank to Sebastian Krysmanski <sebastian@…>

comment:14 by Alex Willmer <al.willmer@…>, 12 years ago

API Changes: modified (diff)
Release Notes: modified (diff)

comment:15 by Remy Blank, 12 years ago

API Changes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Sebastian Krysmanski <sebastian@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Sebastian Krysmanski <sebastian@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.