How can I send a SQLite :memory: database connection ?
I have a non-default SQLite database connection created in a class. I .setdatabasename(:memory:) and then create a table.
How do I access the SAME database from another class ?
I tried sending the QSqlDatabase through a signal but the database became "blank" (no tables besides master).
I tried QSqlDatabase sqlite = QSqlDatabase::database("already-established"); (within the new class) but with the same result.
Is what I am trying to do logically wrong?
ps:pls dont tell me to use default connection.
Thanks
Re: How can I send a SQLite :memory: database connection ?
QSqlDatabase::database("name") should work provided you opened the connection called "name" earlier on using addDatabase().
Re: How can I send a SQLite :memory: database connection ?
thank you for replying !
Yes, thats what I read in the documentation. But it didnt :<. The connection appeared "the same", only there were no tables.
If i pass QSqlDatabase *db then it appears to work.
Re: How can I send a SQLite :memory: database connection ?
Can you show us the respective code? Especially the part where you create the connection and where you pass it to the other part of the application.
Re: How can I send a SQLite :memory: database connection ?
Heh, no need. I tried it again this morning and It worked as it supposed to. Dunno what was wrong last night. Sorry..