09-20-2012 08:37 AM
I am referring to the "Quotes" sample app on https://github.com/blackberry/Cascades-Samples/tre
There a SqlDataAccess object is created and execute() is called.
After that QSqlDatabase::addDatabase is called to create a "non default connection".
Do I have to do that as well? Or could i just work with the SqlDataAccess object? If yes, what would be the up/downsides for that?
Solved! Go to Solution.
09-20-2012 10:06 AM
It seems i can answer my question, working with SqlDataAccess seems to work fine, i only had to ensure the creation of the database with QFile.
I can write my values into the database, but i have some problems reading them, as i don't fully comprehend the QVariant return value.
I execute a sql statement that returns "2" (I use SQLite Database browser to test).
QVariant result = sqlDataAccess->execute("SELECT...)
How do i extract the result from the QVariant?
All the samples throw the whole thing into a listview (or use a different mechanism to query the db).
And how would i do it for a more complex result?
09-21-2012 03:06 PM
Should give you the information you require - whole point of QVariant is that you can define it how you want using toInt, toString etc. QVariant can be used to store any type of data using the value/setValue functions.
09-21-2012 03:32 PM
i am aware of than. But the debugger seems to be unable to tell me what is in the object, and when i call toint() on a QVariant that should contain the value '2' i get 0.
My problem is that i don't really know what the return value stored in QVariant is.
09-30-2012 02:48 AM
10-01-2012 03:30 AM