Just trying to mess around with Qt and SQLite to get familiar with how things work- I haven't really done DB programming since my vb6 days, so please be easy ;]
I'm just trying to get the result of a query and I'm trying to follow some examples I found online (namely this one). The process seems simple enough: create the QSqlQuery object, have it execute a query, check that something came back, and just get the value. When doing this, I'm getting an error. Code follows:
bool DatabaseManager::structureDB(){
QSqlQuery query;
query.exec("CREATE TABLE mytable"
" (id integer primary key,"
" firstname varchar(20),"
" lastname varchar(20),"
" age integer)");
QSqlQuery query2;
query2.exec("pragma table_info(mytable)");
if(query2.first()){
QString test = query2.value(0).toString(); // Error line
qDebug()<<test;
return true;
}
return false;
}
The error I am getting is:
error: invalid use of incomplete type 'struct QVariant'
On the line commented above. I'm not sure what this error means or what I'm doing wrong, can someone please help? Thanks so much!