I'm developing a small utility script for trac which needs to know which is the max ticket id present in each environment.
At this time (with trac 0.11) I'm getting this extracting directly from the trac database with sqlite api, but since we have several environments with different database systems, the intended small utility script is getting bigger doing stupid things.
Is there anything in the trac.* namespace which allows me to find the max ticket id present in an open Environment?
Something which gives me an array with all the tickets or a generator to iterate over all of them will solve my problem.
I can't use the query package because it's an automated/commandline script.
Why do you need to write custom code for the DB connection? There are Trac objects for getting a database connection that abstracts from the actual DB backend.
See the Trac Database API. For 0.11, you should use Environment.get_db_cnx()
, get a Cursor
object with the .cursor()
method and run your query.