Ultim8,
Good to know that at least the library version works!
I gave up and worked around it: QSqlDatabase::driver() will give you QPSQLDriver. With the handle you can extract PGconn, and PGconn you can use with functions from pglib.dll. This way you can implement extra functionality.
Here some brainstorming to make subclassing work with QPSQLDriver as plugin for those interested:
If you compiled the driver as a plugin, then QPSQLDriver* drv = new QPSQLDriver(); or any subclass of QPSQLDriver will give you “undefined reference†errors. But you can initialize one with the following code:
QPluginLoader l
("W:/dev/Qt/4.6.0/plugins/sqldrivers/qsqlpsqld4.dll");
QPSQLDriver *d = dynamic_cast<QPSQLDriver*>(o->create("QPSQL"));
QPluginLoader l("W:/dev/Qt/4.6.0/plugins/sqldrivers/qsqlpsqld4.dll");
QSqlDriverPlugin *o = qobject_cast<QSqlDriverPlugin*>(l.instance());
QPSQLDriver *d = dynamic_cast<QPSQLDriver*>(o->create("QPSQL"));
To copy to clipboard, switch view to plain text mode
Trolls use a factory pattern throughout the driver creation code as far as I see. So QPSQLDriverPlugin::create() is called to produce an instance of QPSQLDriver. Now if one could use the output of QPSQLDriverPlugin::create() as a base class, then one could extend QPSQLDriver, no?
Currently, I don't see a way to do it. But then again, wouldn't something like this be farfetched? Creating a custom plugin, based on QPSQLDriver seems a better approach to me.
Regards,
Davor
Bookmarks