[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] sql database questions
From: Scott Frankel <frankel () circlesfx ! com>
Date: 2009-02-24 21:33:27
Message-ID: 44148411-2F69-46BE-8EDE-F9EA11B0C5AB () circlesfx ! com
[Download RAW message or body]
After reading the documentation and working through example code, I'm
still left with a number of questions regarding how to add, close, and
remove databases. Although my app appears to be working properly, I'm
getting an error msg that I'd like to understand and clean up:
QSqlDatabasePrivate::removeDatabase: connection
'qt_sql_default_connection' is still in use, all queries will cease to
work.
When I add a database, I attempt to set its name:
self.db = QtSql.QSqlDatabase.addDatabase("QPSQL")
self.db.setDatabaseName("foo")
The docs say that the connection is referred to by the
connectionName. Though when I call
QtSql.QSqlDatabase.database().connectionName(), it returns
'qt_sql_default_connection'. The QT docs I found for
setDatabaseName() show an example that does not look at all like a
simple name: (DRIVER={Microsoft Access Driver ... And the example
that ships with PyQt demonstrates how to load a db in memory.
Is it possible/wise to remove the default database? Should I call its
close() method first? e.g.:
connectionName = QtSql.QSqlDatabase.database().connectionName()
QtSql.QSqlDatabase.removeDatabase(connectionName)
Thanks in advance for suggestions on how to manage my db connections!
Scott
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic