[Qt-interest] Custom SQLite Driver

Mohammed Sameer msameer at foolab.org
Sun Nov 29 14:25:26 CET 2009


I'm not an expert here but...

On Sun, Nov 29, 2009 at 12:03:16PM +0000, Neville Dastur wrote:
> I am writing a custom SQLite driver to use the encryption routines from 
> wxSqlite. I have got the whole thing compiling and working by following 
> the docs on writing your own driver 
> (http://qt.nokia.com/doc/4.5/qsqldatabase.html#addDatabase-2) , but I am 
> having a problem including a new method.
> 
> To set a password on the database the ReKey function needs to be called. 
> I created a public method:
>  void QSQLiteDriver::ReKey(const QString & key)
> 
> When calling QSQLDatabase m_db->driver()->ReKey("test"); the function 
> ReKey can't be found.
>  and
> 
> QSQLiteDriver *driver = m_db->driver();
> driver->ReKey("test");

QSQLiteDriver *driver = dynamic_cast<QSQLiteDriver *>(m_db->driver()); // Some might prefer qobject_cast

> What is this the best way of adding new functionality to a QSQLDriver.

Maybe a public slot and then use QMetaObject::invokeMethod() ?

Sounds ugly but I can't find something else ;-)

Cheers,

-- 
GPG-Key: 0xA3FD0DF7 - 9F73 032E EAC9 F7AD 951F  280E CB66 8E29 A3FD 0DF7
Debian User and Developer.
Homepage: www.foolab.org



More information about the Qt-interest-old mailing list