
Originally Posted by
Lesiok
query should be defined AFTER opening DB connection and should looks like :
QSqlQuery query(db);
To copy to clipboard, switch view to plain text mode
I found the problem after you mentioned opening DB connection. Actually the connection was already opened earlier in my initialization function so basically I was trying to open it again every time the release function was called. Instead of opening the connection my meaning was to check that the connection is fine. So with the following lines it seems to be working:
if (!db.isOpen()) {
emit thread_trace_in_main("ERROR: "+DB_NAME, true);
ptr_socket->write("ERROR\n");
emit thread_errors();
return;
}
if (!db.isOpen()) {
emit thread_trace_in_main("ERROR: "+DB_NAME, true);
ptr_socket->write("ERROR\n");
emit thread_errors();
return;
}
To copy to clipboard, switch view to plain text mode
wysota, I kind of get a feeling that I do not know principles of using SQL in threads. Could you light me up a bit?
Thanks again for your time!
Bookmarks