[PyQt] Implementing a QSqlDriver in python -> segmentation fault

Volker Helm Helm.volker at gmx.de
Thu Aug 6 16:15:06 BST 2009


Sorry,

I haven't got any knowledge for you. Why don't you use the ODBC-driver which is implemented. On Linux you'll find normally driver for each OS database.

Bye,

Volker
-------- Original-Nachricht --------
> Datum: Tue, 4 Aug 2009 15:15:35 +0200
> Von: Andre Alexander Bell <pyqt at andre-bell.de>
> An: pyqt at riverbankcomputing.com
> Betreff: [PyQt] Implementing a QSqlDriver in python -> segmentation fault

> Hello,
> 
> I often have the problem, that the Qt installation on some computers is
> not 
> shipped with the mysql plugin. Hence, I can't access a mysql database from
> PyQt on such an computer.
> Since I need to have the same compiler, as Qt has been compiled with, to
> build 
> the plugin myself, I thought it would be far easier to implement my own 
> SqlDriver from within python (e.g. with mysql-python).
> Therefore I subclassed QSqlDriver and QSqlResult from PyQt. However, if I
> do 
> so I get a segmentation fault when I run a query on my database
> connection.
> I stripped the code down to the most simple case which just simulates a 
> database without data.
> As soon as I run a query (QSqlQuery) on this database the python shell
> crashes 
> with a segmentation fault.
> To figure out why I digged into the qt cpp-source code and followed along
> the 
> QSqlQuery::exec(QString query) method. I followed along the lines and
> could 
> repeat the calls on my on PySqlResult created with createResult() method.
> If I do everything in QSqlQuery::exec(QString) my self it works. By using 
> QSqlQuery it does not. I wonder if it has to do something with the
> internal 
> assignements done in QSqlQuery::exec:
> 
> *this = QSqlQuery(...)
> 
> Has anybody ever tried to implement a QSqlDriver in python and succeeded?
> Any 
> hint for me?
> 
> Regards
> 
> 
> Andre
> 

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser


More information about the PyQt mailing list