I'm on fedora linux, and wanted to try sqlite
I don't understand what is wrong here...
What I've made is a simple database and wanted to show contents.
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDebug>
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    if (!QSqlDatabase::isDriverAvailable("QSQLITE"))
    {
        qDebug() << "Error on init";
        return -1;
    }
    QSqlDatabase bd = QSqlDatabase::addDatabase("QSQLITE");
    bd.setDatabaseName("Students.db");
    if (!bd.open())
    {
        qDebug() << bd.lastError().text();
        return -2;
    }
    QSqlQuery q;
    if (!q.exec("create table if not exists students"
           "(id integer not null primary key autoincrement,"
           " name varchar(255) not null,"
           " age integer not null)"))
    {
        qDebug() << q.lastError().text();
        return -3;
    }
    q.exec("insert into students (name, age) values ('Renato', 24 )");
    q.exec("insert into students (name, age) values ('Olive', 40 )");
    q.exec("insert into students (name, age) values ('Cucuo', 19 )");
    q.exec("insert into students (name, age) values ('Renzen', 32 )");
    q.exec("insert into students (name, age) values ('Polai', 21 )");
    q.exec("insert into students (name, age) values ('Mogo', 29 )");
    q.exec("select * from students");
    while (q.next())
    {
        qDebug() << q.value("id").toInt();
        qDebug() << q.value("name").toString();
        qDebug() << q.value("age").toInt();
    }
    bd.close();
    return a.exec();
}
The program compiles perfectly without errors and just shows me an empty console, no line is prompted.
Update
I can access the database via command line and it shows that the queries are successfuly done.
now I'm wondering if the qDebug() function is working correctly
 
    
