When running this program code, it is concluded that the database is connected, as well as that the dimension of query = 2, after which an error occurs when trying to call the guery.value function. The Segmentation Fault error, why it happens is unclear. I need help. Here is the program code:
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL", "cash");
db.setConnectOptions("requiressl=1;connect_timeout=2");
db.setHostName("rdbmsastra.vt");
db.setPort(5432);
db.setDatabaseName("cvcomputer");
db.setUserName("astra");
db.setPassword("123451");
db.open();
if (db.isOpen()){
qDebug() << "Success open DB";
} else qDebug() << "FAIL" << db.lastError().text();
QSqlQuery query("select * from status", db);
qDebug() << query.size();
while(query.next()){
qDebug() << query.value("id_s").toInt();
qDebug() << query.value("discription").toString();
}
programming takes place on windows 10 in qt creator.
I hope for your help