I don't know if I've got myself complete sidetracked with this, but I
thought I'd share. I started hacking on DBConnection.py a little bit so
that:
- you can test if a particular connection type will work with
DBAPI.isSupported() (e.g. SQLiteConnection.isSupported())
- get a list of all supported drivers with
SQLObject.getSupportedDrivers()
- create an appropriate DBAPI object according to a DB URI (e.g.
"sqlite:///home/user/database.db" or "mysql://user:pass@host/db")
- save the connection parameters as an URI (e.g. getURI() called on a
MySQLConnection object gives "mysql://user:pass@host/db")
I haven't added the required code for all of the different connection
drivers, so your mileage will vary.
Is the right approach to take to opening up database connections in a
generic way? I want the user of my software to be able to configure his
database settings pretty easily.
Cheers,
Chris
--
Chris AtLee <ch...@at...>
|