diff options
Diffstat (limited to 'src/sql/kernel/qsqldatabase.cpp')
-rw-r--r-- | src/sql/kernel/qsqldatabase.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 412658e39c..06c5f56d50 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -365,6 +365,14 @@ void QSqlDatabasePrivate::disable() cloneDatabase() to create an independent database connection based on an existing one. + \warning It is highly recommended that you do not keep a copy of the + QSqlDatabase around as a member of a class, as this will prevent the + instance from being correctly cleaned up on shutdown. If you need to + access an existing QSqlDatabase, it should be accessed with database(). + If you chose to have a QSqlDatabase member variable, this needs to be + deleted before the QCoreApplication instance is deleted, otherwise it + may lead to undefined behavior. + If you create multiple database connections, specify a unique connection name for each one, when you call addDatabase(). Use database() with a connection name to get that connection. Use |