Hi,

I am creating a plug-in and need a to add a table to the database.
Here is what I came up with:

classMyEventProvider(Component):
    implements(ITimelineEventProvider)

    def __init__(self):
        db = self.env.get_db_cnx()
        cursor = db.cursor()
        try:
            cursor.execute("select count(*) from my_table")
            db.commit()
        except:
            connector, dummy = DatabaseManager(self.env)._get_connector
()
            for table in schema:
                for stmt in connector.to_sql(table):
                    self.log.debug('Will execute: %s' % stmt)
                    cursor.execute(stmt)
            db.commit()
...

Is there a better way to do it?

Thanks,

Damien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to